<!DOCTYPE html>
<!-- saved from url=(0048)https://google.github.io/styleguide/jsguide.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Google JavaScript Style Guide</title>
<link rel="stylesheet" href="./Google JavaScript Style Guide_files/javaguide.css">
<script src="./Google JavaScript Style Guide_files/styleguide.js.下载"></script>
<link rel="shortcut icon" href="https://www.google.com/favicon.ico">
<script src="./Google JavaScript Style Guide_files/jsguide.js.下载"></script>
<style type="text/css">.simpread-theme-root{font-size:62.5%!important}sr-rd-content,sr-rd-desc,sr-rd-title{width:100%}sr-rd-title{display:-webkit-box;margin:1em 0 .5em;overflow:hidden;text-overflow:ellipsis;text-rendering:optimizelegibility;-webkit-line-clamp:3;-webkit-box-orient:vertical}sr-rd-content{text-align:left;word-break:break-word}sr-rd-desc{text-align:justify;line-height:2.4;margin:0 0 1.2em;box-sizing:border-box}sr-rd-content{font-size:25.6px;font-size:1.6rem;line-height:1.6}sr-rd-content h1,sr-rd-content h1 *,sr-rd-content h2,sr-rd-content h2 *,sr-rd-content h3,sr-rd-content h3 *,sr-rd-content h4,sr-rd-content h4 *,sr-rd-content h5,sr-rd-content h5 *,sr-rd-content h6,sr-rd-content h6 *{word-break:break-all}sr-rd-content div,sr-rd-content p{display:block;float:inherit;line-height:1.6;font-size:25.6px;font-size:1.6rem}sr-rd-content div,sr-rd-content p,sr-rd-content pre,sr-rd-content sr-blockquote{margin:0 0 1.2em;word-break:break-word}sr-rd-content a{padding:0 5px;vertical-align:baseline;vertical-align:initial}sr-rd-content a,sr-rd-content a:link{color:inherit;font-size:inherit;font-weight:inherit;border:none}sr-rd-content a:hover{background:transparent}sr-rd-content img{margin:10px;padding:5px;max-width:100%;background:#fff;border:1px solid #bbb;box-shadow:1px 1px 3px #d4d4d4}sr-rd-content figcaption{text-align:center;font-size:14px}sr-rd-content sr-blockquote{display:block;position:relative;padding:15px 25px;text-align:left;line-height:inherit}sr-rd-content sr-blockquote:before{position:absolute}sr-rd-content sr-blockquote *{margin:0;font-size:inherit}sr-rd-content table{width:100%;margin:0 0 1.2em;word-break:keep-all;word-break:normal;overflow:auto;border:none}sr-rd-content table td,sr-rd-content table th{border:none}sr-rd-content ul{margin:0 0 1.2em;margin-left:1.3em;padding:0;list-style:disc}sr-rd-content ol{list-style:decimal;margin:0;padding:0}sr-rd-content ol li,sr-rd-content ul li{font-size:inherit;list-style:disc;margin:0 0 1.2em}sr-rd-content ol li{list-style:decimal;margin-left:1.3em}sr-rd-content ol li *,sr-rd-content ul li *{margin:0;text-align:left;text-align:initial}sr-rd-content li ol,sr-rd-content li ul{margin-bottom:.8em;margin-left:2em}sr-rd-content li ul{list-style:circle}sr-rd-content pre{font-family:Consolas,Monaco,Andale Mono,Source Code Pro,Liberation Mono,Courier,monospace;display:block;padding:15px;line-height:1.5;word-break:break-all;word-wrap:break-word;white-space:pre;overflow:auto}sr-rd-content pre,sr-rd-content pre *,sr-rd-content pre div{font-size:17.6px;font-size:1.1rem}sr-rd-content li pre code,sr-rd-content p pre code,sr-rd-content pre{background-color:transparent;border:none}sr-rd-content pre code{margin:0;padding:0}sr-rd-content pre code,sr-rd-content pre code *{font-size:17.6px;font-size:1.1rem}sr-rd-content pre p{margin:0;padding:0;color:inherit;font-size:inherit;line-height:inherit}sr-rd-content li code,sr-rd-content p code{margin:0 4px;padding:2px 4px;font-size:17.6px;font-size:1.1rem}sr-rd-content mark{margin:0 5px;padding:2px;background:#fffdd1;border-bottom:1px solid #ffedce}.sr-rd-content-img{width:90%;height:auto}.sr-rd-content-img-load{width:48px;height:48px;margin:0;padding:0;border-style:none;border-width:0;background-repeat:no-repeat;background-image:url()}.sr-rd-content-center{text-align:center;display:-webkit-box;-webkit-box-align:center;-webkit-box-pack:center;-webkit-box-orient:vertical}.sr-rd-content-center-small{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}.sr-rd-content-center-small img{margin:0;padding:0;border:0;box-shadow:none}img.simpread-img-broken{cursor:pointer}.sr-rd-content-nobeautify{margin:0;padding:0;border:0;box-shadow:0 0 0}sr-rd-mult{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;margin:0 0 16px;padding:16px 0 24px;width:100%;background-color:#fff;border-radius:4px;box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 2px 6px 2px rgba(60,64,67,.15)}sr-rd-mult:hover{-webkit-transition:all .45s 0ms;transition:all .45s 0ms;box-shadow:1px 1px 8px rgba(0,0,0,.16)}sr-rd-mult sr-rd-mult-content{padding:0 16px;overflow:auto}sr-rd-mult sr-rd-mult-avatar,sr-rd-mult sr-rd-mult-content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}sr-rd-mult sr-rd-mult-avatar{-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:0 15px}sr-rd-mult sr-rd-mult-avatar span{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;max-width:75px;overflow:hidden;text-overflow:ellipsis;text-align:left;font-size:16px;font-size:1rem}sr-rd-mult sr-rd-mult-avatar img{margin-bottom:0;max-width:50px;max-height:50px;width:50px;height:50px;border-radius:50%}sr-rd-mult sr-rd-mult-content img{max-width:80%}sr-rd-mult sr-rd-mult-avatar .sr-rd-content-center{margin:0}sr-page{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;width:100%}</style><style type="text/css">sr-rd-theme-github{display:none}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{position:relative;margin-top:1em;margin-bottom:1pc;font-weight:700;line-height:1.4;text-align:left;color:#363636}sr-rd-content h1{padding-bottom:.3em;font-size:57.6px;font-size:3.6rem;line-height:1.2}sr-rd-content h2{padding-bottom:.3em;font-size:44.8px;font-size:2.8rem;line-height:1.225}sr-rd-content h3{font-size:38.4px;font-size:2.4rem;line-height:1.43}sr-rd-content h4{font-size:32px;font-size:2rem}sr-rd-content h5,sr-rd-content h6{font-size:25.6px;font-size:1.6rem}sr-rd-content h6{color:#777}sr-rd-content ol,sr-rd-content ul{list-style-type:disc;padding:0;padding-left:2em}sr-rd-content ol ol,sr-rd-content ul ol{list-style-type:lower-roman}sr-rd-content ol ol ol,sr-rd-content ol ul ol,sr-rd-content ul ol ol,sr-rd-content ul ul ol{list-style-type:lower-alpha}sr-rd-content table{width:100%;overflow:auto;word-break:normal;word-break:keep-all}sr-rd-content table th{font-weight:700}sr-rd-content table td,sr-rd-content table th{padding:6px 13px;border:1px solid #ddd}sr-rd-content table tr{background-color:#fff;border-top:1px solid #ccc}sr-rd-content table tr:nth-child(2n){background-color:#f8f8f8}sr-rd-content sr-blockquote{border-left:4px solid #ddd}.simpread-theme-root{background-color:#fff;color:#333}sr-rd-title{font-family:PT Sans,SF UI Display,\.PingFang SC,PingFang SC,Neue Haas Grotesk Text Pro,Arial Nova,Segoe UI,Microsoft YaHei,Microsoft JhengHei,Helvetica Neue,Source Han Sans SC,Noto Sans CJK SC,Source Han Sans CN,Noto Sans SC,Source Han Sans TC,Noto Sans CJK TC,Hiragino Sans GB,sans-serif;font-size:54.4px;font-size:3.4rem;font-weight:700;line-height:1.3}sr-rd-desc{position:relative;margin:0;margin-bottom:30px;padding:25px;padding-left:56px;font-size:28.8px;font-size:1.8rem;color:#777;background-color:rgba(0,0,0,.05);box-sizing:border-box}sr-rd-desc:before{content:"\201C";position:absolute;top:-28px;left:16px;font-size:80px;font-family:Arial;color:rgba(0,0,0,.15)}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{color:#363636;font-weight:400;line-height:1.8}sr-rd-content b *,sr-rd-content strong,sr-rd-content strong * sr-rd-content b{-webkit-animation:none 0s ease 0s 1 normal none running;animation:none 0s ease 0s 1 normal none running;-webkit-backface-visibility:visible;backface-visibility:visible;background:transparent none repeat 0 0/auto auto padding-box border-box scroll;border:medium none currentColor;border-collapse:separate;-o-border-image:none;border-image:none;border-radius:0;border-spacing:0;bottom:auto;box-shadow:none;box-sizing:content-box;caption-side:top;clear:none;clip:auto;color:#000;-webkit-columns:auto;-moz-columns:auto;columns:auto;-webkit-column-count:auto;-moz-column-count:auto;column-count:auto;-webkit-column-fill:balance;-moz-column-fill:balance;column-fill:balance;-webkit-column-gap:normal;-moz-column-gap:normal;column-gap:normal;-webkit-column-rule:medium none currentColor;-moz-column-rule:medium none currentColor;column-rule:medium none currentColor;-webkit-column-span:1;-moz-column-span:1;column-span:1;-webkit-column-width:auto;-moz-column-width:auto;column-width:auto;content:normal;counter-increment:none;counter-reset:none;cursor:auto;direction:ltr;display:inline;empty-cells:show;float:none;font-family:serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;line-height:normal;height:auto;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;list-style:disc outside none;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;orphans:2;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;-webkit-perspective:none;perspective:none;-webkit-perspective-origin:50% 50%;perspective-origin:50% 50%;position:static;right:auto;-moz-tab-size:8;-o-tab-size:8;tab-size:8;table-layout:auto;text-align:left;text-align-last:auto;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;-webkit-transform:none;transform:none;-webkit-transform-origin:50% 50% 0;transform-origin:50% 50% 0;-webkit-transform-style:flat;transform-style:flat;-webkit-transition:none 0s ease 0s;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:2;width:auto;word-spacing:normal;z-index:auto;all:initial}sr-rd-content a,sr-rd-content a:link{color:#4183c4;text-decoration:none}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#4183c4;text-decoration:underline}sr-rd-content pre{background-color:#f7f7f7;border-radius:3px}sr-rd-content li code,sr-rd-content p code{background-color:rgba(0,0,0,.04);border-radius:3px}.simpread-multi-root{background:#f8f9fa}</style><style type="text/css">sr-rd-theme-newsprint{display:none}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{font-weight:700}sr-rd-content h1{font-size:48px;font-size:3rem;line-height:1.6em;margin-top:2em}sr-rd-content h2,sr-rd-content h3{font-size:32px;font-size:2rem;line-height:1.15;margin-top:2.285714em;margin-bottom:1.15em}sr-rd-content h3{font-weight:400}sr-rd-content h4{font-size:28.8px;font-size:1.8rem;margin-top:2.67em}sr-rd-content h5,sr-rd-content h6{font-size:25.6px;font-size:1.6rem}sr-rd-content h1{border-bottom:1px solid;margin-bottom:1.875em;padding-bottom:.8125em}sr-rd-content ol,sr-rd-content ul{margin:0 0 1.5em 1.5em}sr-rd-content ol li{list-style-type:decimal;list-style-position:outside}sr-rd-content ul li{list-style-type:disc;list-style-position:outside}sr-rd-content table{width:100%;margin-bottom:1.5em;font-size:25.6px;font-size:1.6rem}sr-rd-content thead th,tfoot th{padding:.25em .25em .25em .4em;text-transform:uppercase}sr-rd-content th{text-align:left}sr-rd-content td{vertical-align:top;padding:.25em .25em .25em .4em}sr-rd-content thead{background-color:#dadada}sr-rd-content tr:nth-child(2n){background:#e8e7e7}sr-rd-content sr-blockquote{padding:10px 15px;border-left-style:solid;border-left-width:10px;border-color:#d6dbdf;background:none repeat scroll 0 0 rgba(102,128,153,.05);text-align:left}sr-rd-content sr-blockquote:before{content:""}.simpread-multi-root,.simpread-theme-root{background-color:#f3f2ee;color:#2c3e50}sr-rd-title{font-family:PingFang SC,Hiragino Sans GB,Microsoft Yahei,WenQuanYi Micro Hei,sans-serif;line-height:1.5;font-weight:500;font-size:48px;font-size:3rem;color:#07b;border-bottom:1px solid;margin-bottom:1.875em;padding-bottom:.8125em}sr-rd-desc{color:rgba(102,128,153,.6);background-color:rgba(102,128,153,.075);border-radius:4px;margin-bottom:1em;padding:15px;font-size:32px;font-size:2rem;line-height:1.5;text-align:center}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{line-height:1.8;color:#2c3e50}sr-rd-content a,sr-rd-content a:link{color:#08c;text-decoration:none}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#5ba4e5}sr-rd-content li code,sr-rd-content p code,sr-rd-content pre{background-color:#dadada}sr-rd-mult{background-color:rgba(102,128,153,.075)}</style><style type="text/css">sr-rd-theme-gothic{display:none}sr-rd-content h1{line-height:64px;line-height:4rem;margin:64px 0 28px;margin:4rem 0 1.75rem;padding:20px 30px}sr-rd-content h1,sr-rd-content h2{font-weight:400;text-align:center;text-transform:uppercase}sr-rd-content h2{line-height:48px;line-height:3rem;margin:48px 0 31px;margin:3rem 0 1.9375rem;padding:0 30px}sr-rd-content h3,sr-rd-content h4,sr-rd-content h5{font-weight:400}sr-rd-content h6{font-weight:700}sr-rd-content h1{font-size:57.6px;font-size:3.6rem}sr-rd-content h2{font-size:51.2px;font-size:3.2rem}sr-rd-content h3{font-size:40px;font-size:2.5rem}sr-rd-content h4{font-size:35.2px;font-size:2.2rem}sr-rd-content h5{font-size:30.4px;font-size:1.9rem}sr-rd-content h6{font-size:27.2px;font-size:1.7rem}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{margin-top:1.2em;margin-bottom:.6em;color:#111}sr-rd-content ol,sr-rd-content ul{list-style-type:disc;margin-left:3em}sr-rd-content ol ol,sr-rd-content ul ol{list-style-type:lower-roman}sr-rd-content ol ol ol,sr-rd-content ol ul ol,sr-rd-content ul ol ol,sr-rd-content ul ul ol{list-style-type:lower-alpha}sr-rd-content table{margin-bottom:20px}sr-rd-content table td,sr-rd-content table th{padding:8px;line-height:20px;line-height:1.25rem;vertical-align:top;border-top:1px solid #ddd}sr-rd-content table th{font-weight:700}sr-rd-content table thead th{vertical-align:bottom}sr-rd-content table caption+thead tr:first-child td,sr-rd-content table caption+thead tr:first-child th,sr-rd-content table colgroup+thead tr:first-child td,sr-rd-content table colgroup+thead tr:first-child th,sr-rd-content table thead:first-child tr:first-child td,sr-rd-content table thead:first-child tr:first-child th{border-top:0}sr-rd-content table tbody+tbody{border-top:2px solid #ddd}sr-rd-content sr-blockquote{margin:0 0 17.777px;margin:0 0 1.11111rem;padding:8px 17.777px 0 16.888px;padding:.5rem 1.11111rem 0 1.05556rem;border-left:1px solid gray}sr-rd-content sr-blockquote,sr-rd-content sr-blockquote p{line-height:2;color:#6f6f6f}.simpread-multi-root,.simpread-theme-root{background:#fcfcfc;color:#333}sr-rd-title{font-weight:400;line-height:64px;line-height:4rem;text-align:center;text-transform:uppercase;color:#111;font-size:51.2px;font-size:3.2rem}sr-rd-desc{margin:0 0 17.777px;margin:0 0 1.11111rem;padding:8px 17.777px 0 16.888px;padding:.5rem 1.11111rem 0 1.05556rem;font-size:32px;font-size:2rem;line-height:2;color:#6f6f6f;border-left:1px solid gray}sr-rd-content{font-weight:400;color:#333}sr-rd-content *,sr-rd-content div,sr-rd-content p{color:#333}sr-rd-content a,sr-rd-content a:link{color:#900;text-decoration:none}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#900;text-decoration:underline}sr-rd-content li code,sr-rd-content p code,sr-rd-content pre{background-color:transparent;border:1px solid #ccc}sr-rd-mult{background-color:#f2f2f2}</style><style type="text/css">sr-rd-theme-engwrite{display:none}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{margin:20px 0 10px;padding:0;font-weight:500;-webkit-font-smoothing:antialiased}sr-rd-content h1{font-weight:300;text-align:center;font-size:44.8px;font-size:2.8rem;color:#933d3f}sr-rd-content h2{font-size:38.4px;font-size:2.4rem;border-bottom:1px solid #ccc;color:#000}sr-rd-content h3{font-size:28.8px;font-size:1.8rem}sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{font-size:25.6px;font-size:1.6rem}sr-rd-content h6{color:#777}sr-rd-content ol,sr-rd-content ul{padding-left:30px}sr-rd-content ol li>:first-child,sr-rd-content ol li ol:first-of-type,sr-rd-content ol li ul:first-of-type,sr-rd-content ul li>:first-child,sr-rd-content ul li ol:first-of-type,sr-rd-content ul li ul:first-of-type{margin-top:0}sr-rd-content ol ol,sr-rd-content ol ul,sr-rd-content ul ol,sr-rd-content ul ul{margin-bottom:0}sr-rd-content table th{font-weight:700}sr-rd-content table td,sr-rd-content table th{border:1px solid #ccc;padding:6px 13px}sr-rd-content table tr{border-top:1px solid #ccc;background-color:#fff}sr-rd-content table tr:nth-child(2n){background-color:#f8f8f8}sr-rd-content sr-blockquote{text-align:left;border-top:1px dotted #cdc7bc;border-bottom:1px dotted #cdc7bc;background-color:#f8edda;color:#777}sr-blockquote>:first-child{margin-top:0}sr-blockquote>:last-child{margin-bottom:0}.simpread-multi-root,.simpread-theme-root{background-color:#fcf5ed;color:#333}sr-rd-title{font-weight:300;text-align:center;font-size:44.8px;font-size:2.8rem;color:#933d3f}sr-rd-desc{padding:10px;background-color:#f8edda;color:#777;font-size:32px;font-size:2rem;text-align:center;border-top:1px dotted #cdc7bc;border-bottom:1px dotted #cdc7bc}sr-rd-content{padding:20px 0;margin:0 auto}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{color:#333;line-height:1.8}sr-rd-content a,sr-rd-content a:link{color:#ae3737;text-decoration:none}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{text-decoration:underline}sr-rd-content pre{background-color:transparent;border:1px solid #ccc;border-radius:3px}sr-rd-content li code,sr-rd-content p code{border:1px solid #eaeaea;background-color:#f4ece3;border-radius:3px}sr-rd-mult{background-color:#f8edda}</style><style type="text/css">sr-rd-theme-octopress{display:none}sr-rd-content h1{font-size:56.32px;font-size:3.52rem;line-height:30.72px;line-height:1.92rem}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{text-rendering:optimizelegibility;margin-bottom:20.8px;margin-bottom:1.3rem;font-weight:700}sr-rd-content h2{font-size:38.4px;font-size:2.4rem}sr-rd-content h3{font-size:33.28px;font-size:2.08rem}sr-rd-content h4{font-size:28.8px;font-size:1.8rem}sr-rd-content h5,sr-rd-content h6{font-size:25.6px;font-size:1.6rem}sr-rd-content h1,sr-rd-content h2{padding-top:27.2px;padding-top:1.7rem;padding-bottom:19.2px;padding-bottom:1.2rem;background:url("") 0 100% repeat-x}sr-rd-content h2{padding-top:20.8px;padding-top:1.3rem;padding-bottom:0}sr-rd-content ul{list-style-type:disc}sr-rd-content ul ul{list-style-type:circle;margin-bottom:0}sr-rd-content ul ul ul{list-style-type:square;margin-bottom:0}sr-rd-content ol{list-style-type:decimal}sr-rd-content ol ol{list-style-type:lower-alpha;margin-bottom:0}sr-rd-content ol ol ol{list-style-type:lower-roman;margin-bottom:0}sr-rd-content ol,sr-rd-content ol ol,sr-rd-content ol ul,sr-rd-content ul,sr-rd-content ul ol,sr-rd-content ul ul{margin-left:1.3em}sr-rd-content ol ol,sr-rd-content ol ul,sr-rd-content ul ol,sr-rd-content ul ul{margin-bottom:0}sr-rd-content table{width:100%;overflow:auto;word-break:normal;word-break:keep-all}sr-rd-content table th{font-weight:700}sr-rd-content table td,sr-rd-content table th{padding:6px 13px;border:1px solid #ddd}sr-rd-content table tr{background-color:#fff;border-top:1px solid #ccc}sr-rd-content table tr:nth-child(2n){background-color:#f8f8f8}sr-rd-content sr-blockquote{font-style:italic;font-size:inherit;line-height:2;padding-left:1em;border-left:4px solid hsla(0,0%,67%,.5)}.simpread-multi-root,.simpread-theme-root{background:#f8f8f8 url("") 0 0;color:#333}sr-rd-title{font-size:56.32px;font-size:3.52rem;line-height:64px;line-height:4rem;font-weight:700;background:url(…sTAAALEwEAmpwYAAAAFUlEQVQIHWNIS0sr/v//PwMMDzY+ADqMahlW4J91AAAAAElFTkSuQmCC) 0 100% repeat-x}sr-rd-desc{font-style:italic;font-size:30.72px;font-size:1.92rem;line-height:2;padding-left:1em;border-left:4px solid hsla(0,0%,67%,.5)}sr-rd-content{margin:0 auto;padding:1em 0}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{line-height:2;color:#333}sr-rd-content a,sr-rd-content a:link{color:#1863a1;text-decoration:underline}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#0181eb;text-decoration:underline}sr-rd-content pre{color:#586e75;background-color:#fdf6e3;border-radius:.4em;border:1px solid #e7dec3}sr-rd-content li code,sr-rd-content p code{color:#555;background-color:transparent;border:1px solid #ddd}sr-rd-mult{background-color:#ededed}</style><style type="text/css">sr-rd-theme-pixyii{display:none}sr-rd-content h1,sr-rd-content h1 *,sr-rd-content h2,sr-rd-content h2 *,sr-rd-content h3,sr-rd-content h3 *,sr-rd-content h4,sr-rd-content h4 *,sr-rd-content h5,sr-rd-content h5 *,sr-rd-content h6,sr-rd-content h6 *{color:inherit;font-weight:900;line-height:1.2;margin:1em 0}sr-rd-content h1,sr-rd-content h1 *{font-size:62.72px;font-size:3.92rem}sr-rd-content h2,sr-rd-content h2 *{font-size:58.24px;font-size:3.64rem}sr-rd-content h3,sr-rd-content h3 *{font-size:36.4px;font-size:2.275rem}sr-rd-content h4,sr-rd-content h4 *{font-size:29.12px;font-size:1.82rem}sr-rd-content h5,sr-rd-content h5 *,sr-rd-content h6,sr-rd-content h6 *{font-size:25.168px;font-size:1.573rem}sr-rd-content ol,sr-rd-content ul{font-size:28px;font-size:1.75rem;line-height:24px;line-height:1.5rem}sr-rd-content li{font-size:25.2px;font-size:1.575rem;line-height:1.8;margin:0;position:relative}sr-rd-content table{width:100%;font-size:25.2px;font-size:1.575rem}sr-rd-content table>tbody>tr>td,sr-rd-content table>tbody>tr>th,sr-rd-content table>tfoot>tr>td,sr-rd-content table>tfoot>tr>th,sr-rd-content table>thead>tr>td,sr-rd-content table>thead>tr>th{padding:12px;line-height:1.2;vertical-align:top;border-top:1px solid #333}sr-rd-content table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #333}sr-rd-content table>caption+thead>tr:first-child>td,sr-rd-content table>caption+thead>tr:first-child>th,sr-rd-content table>colgroup+thead>tr:first-child>td,sr-rd-content table>colgroup+thead>tr:first-child>th,sr-rd-content table>thead:first-child>tr:first-child>td,sr-rd-content table>thead:first-child>tr:first-child>th{border-top:0}sr-rd-content table>tbody+tbody{border-top:2px solid #333}sr-rd-content sr-blockquote{margin:16px 0;margin:1rem 0;padding:1.33em;font-style:italic;border-left:5px solid #7a7a7a;color:#555}.simpread-theme-root{background-color:#fff;color:#555}sr-rd-title{font-family:PingFang SC,Hiragino Sans GB,Microsoft Yahei,WenQuanYi Micro Hei,sans-serif;font-size:67.2px;font-size:4.2rem;font-weight:900;line-height:1.2}sr-rd-desc{margin:16px 0;margin:1rem 0;padding:1.33em;font-style:italic;font-size:32px;font-size:2rem;line-height:2;border-left:5px solid #7a7a7a;color:#555}sr-rd-content{font-size:33.6px;font-size:2.1rem;line-height:1.8;font-weight:400;color:#555}sr-rd-content *,sr-rd-content div,sr-rd-content p{color:#555;font-size:28px;font-size:1.75rem;line-height:1.8;font-weight:300}sr-rd-content b,sr-rd-content b *,sr-rd-content strong,sr-rd-content strong *{font-weight:700}sr-rd-content a,sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover,sr-rd-content a:link{color:#463f5c;text-decoration:underline}sr-rd-content sr-blockquote code{font-size:inherit}sr-rd-content pre{border:1px solid #7a7a7a}sr-rd-content li code,sr-rd-content p code,sr-rd-content pre{color:#7a7a7a;background-color:transparent}.simpread-multi-root{background:#f8f9fa}</style><style type="text/css">sr-rd-theme-monospace{display:none}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{font-weight:700;color:#6363ac}sr-rd-content h1{font-size:35.2px;font-size:2.2rem}sr-rd-content h2{font-size:32px;font-size:2rem}sr-rd-content h3{font-size:28.8px;font-size:1.8rem}sr-rd-content h4{font-size:25.6px;font-size:1.6rem}sr-rd-content h5{font-size:22.4px;font-size:1.4rem}sr-rd-content h6{font-size:20.8px;font-size:1.3rem}sr-rd-content strong{color:#b5302e}sr-rd-content em{font-style:italic;color:#400469}sr-rd-content ol,sr-rd-content ul{list-style-type:none}sr-rd-content ol li,sr-rd-content ul li{margin:0}sr-rd-content table{line-height:25.6px;line-height:1.6rem;border-collapse:collapse;border-spacing:0;empty-cells:show;border:1px solid #cbcbcb}sr-rd-content thead{background-color:#e0e0e0;color:#000;text-align:left;vertical-align:bottom}sr-rd-content td,sr-rd-content th{border-left:1px solid #cbcbcb;border-width:0 0 0 1px;margin:0;overflow:visible;padding:.5em 1em}sr-rd-content sr-blockquote{background-color:hsla(0,0%,50%,.05);border-top-right-radius:5px;border-bottom-right-radius:5px;border-left:8px solid #979797;line-height:2}sr-rd-content sr-blockquote *{line-height:inherit}.simpread-theme-root{color:#333;background:#fff}sr-rd-title{font-size:44.8px;font-size:2.8rem;line-height:1.2;font-weight:700;color:#6363ac}sr-rd-desc{padding:10px;background-color:hsla(0,0%,50%,.05);font-size:28.8px;font-size:1.8rem;text-align:center;border-top-right-radius:5px;border-bottom-right-radius:5px;border-left:8px solid #979797}sr-rd-content{color:#333}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{line-height:1.7}sr-rd-content a,sr-rd-content a:link{color:#005dad;text-decoration:underline}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#fff;background-color:#2a6496;text-decoration:none}sr-rd-content pre{color:#e9eded;background-color:#263238}sr-rd-content li code,sr-rd-content p code{color:#949415;background-color:transparent}.simpread-multi-root{background:#f8f9fa}</style><style type="text/css">sr-rd-theme-night{display:none}sr-rd-content h1{margin-top:2em}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{color:#dedede;font-weight:400;clear:both;-ms-word-wrap:break-word;word-wrap:break-word;margin:0;padding:0}sr-rd-content h1{font-size:57.6px;font-size:3.6rem;line-height:64px;line-height:4rem;margin-bottom:38.4px;margin-bottom:2.4rem;letter-spacing:-1.5px}sr-rd-content h2{font-size:38.4px;font-size:2.4rem;line-height:48px;line-height:3rem}sr-rd-content h2,sr-rd-content h3{margin-bottom:38.4px;margin-bottom:2.4rem;letter-spacing:-1px}sr-rd-content h3{font-size:28.8px;font-size:1.8rem;line-height:38.4px;line-height:2.4rem}sr-rd-content h4{font-size:25.6px;font-size:1.6rem;line-height:35.2px;line-height:2.2rem;margin-bottom:38.4px;margin-bottom:2.4rem}sr-rd-content h5{font-size:16px;font-size:1rem;line-height:20px;line-height:1.25rem;margin-bottom:24px;margin-bottom:1.5rem}sr-rd-content h6{font-size:25.6px;font-size:1.6rem;line-height:25.6px;line-height:1.6rem;margin-bottom:12px;margin-bottom:.75rem;font-weight:700}sr-rd-content ol,sr-rd-content ul{padding:0 0 0 30px;padding:0 0 0 1.875rem}sr-rd-content ul{list-style:square}sr-rd-content ol{list-style:decimal}sr-rd-content ol ol,sr-rd-content ol ul,sr-rd-content ul ol,sr-rd-content ul ul{margin:0}sr-rd-content li div{padding-top:0}sr-rd-content li,sr-rd-content li p{margin:0;position:relative}sr-rd-content table{margin-top:0;margin-bottom:24px;margin-bottom:1.5rem;border-collapse:collapse;border-spacing:0;page-break-inside:auto;text-align:left}sr-rd-content table a{color:#dedede}sr-rd-content thead{display:table-header-group}sr-rd-content table td,sr-rd-content table th{border:1px solid #474d54}sr-rd-content sr-blockquote{margin:0 0 30px 30px;margin:0 0 1.875rem 1.875rem;border-left:2px solid #474d54;padding-left:30px;margin-top:35px;line-height:2}.simpread-multi-root,.simpread-theme-root{background:#363b40;color:#b8bfc6}sr-rd-title{color:#dedede;font-size:50.4px;font-size:3.15rem;line-height:56px;line-height:3.5rem;letter-spacing:-1.5px}sr-rd-desc{margin:35px;margin-left:0;padding-left:30px;padding-left:1.875rem;font-size:32px;font-size:2rem;line-height:2;border-left:2px solid #474d54}sr-rd-content,sr-rd-desc{color:#b8bfc6}sr-rd-content *,sr-rd-content div,sr-rd-content p{color:#b8bfc6;margin-top:0;line-height:2}sr-rd-content a,sr-rd-content a:link{color:#e0e0e0;text-decoration:underline;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#fff}sr-rd-content pre{background-color:transparent;border:1px solid}sr-rd-content li code,sr-rd-content p code{background:rgba(0,0,0,.05)}sr-rd-mult{background-color:#2d3034}panel{background-color:#2e2e2e!important}panel panel-tab span{color:#fff}panel sr-opt-gp sr-opt-label{color:rgba(108,255,240,.8);font-weight:400}panel text-field-float{color:rgba(108,255,240,.8)!important;font-weight:400!important}panel list-field{background-color:transparent!important}panel list-field:hover list-field-name{color:#fff!important;font-weight:700}panel input,panel list-field-name{color:hsla(35,10%,76%,.87)!important}panel list-view{background-color:#2e2e2e!important}panel sr-opt-gp action-label,panel switch content *{color:#fff!important}panel-tabs{border-bottom-color:#393d40!important}sr-annote{color:#333}sr-annote-sidebar *{color:hsla(36,10%,90%,.9)!important}sr-annote-sidebar-card[type=unread]{background-color:#19896e!important}sr-annote-sidebar-card:hover{box-shadow:0 10px 20px 0 rgba(60,73,82,.6)!important}sr-annote-sidebar-note,sr-annote-sidebar-options,sr-annote-sidebar-toolbars{background-color:#282b2d!important}sr-rd-theme-night-comp{display:none;opacity:0}dialog-content,dialog-footer{color:#b8bfc6!important;background-color:#2e2e2e!important}dialog-content *{color:#b8bfc6!important}dialog-content svg path{fill:#b8bfc6!important}dialog-content button-text{color:#b8bfc6!important}dialog-content text-field-state{border-top:none #b8bfc6!important;border-left:none #b8bfc6!important;border-right:none #b8bfc6!important;border-bottom:2px solid #b8bfc6!important}dialog-footer button-text{color:#b8bfc6!important}auto-complete list-view,dropdown list-view{color:#b8bfc6!important;background-color:#2e2e2e!important}auto-complete list-field,dropdown list-field{-webkit-transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;transition:all .45s cubic-bezier(.23,1,.32,1) 0ms}auto-complete list-field[active=true],dropdown list-field[active=true]{color:#b8bfc6!important;background-color:#1b1b1b!important}auto-complete tag{background-color:#1b1b1b!important}sr-rd-theme-night-comp{display:none}</style><style type="text/css">sr-rd-theme-dark{display:none}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{font-weight:700;color:#dbdbfd}sr-rd-content h1{font-size:48px;font-size:3rem}sr-rd-content h2{font-size:44.8px;font-size:2.8rem}sr-rd-content h3{font-size:40px;font-size:2.5rem}sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{color:#549ad8}sr-rd-content h5{font-size:32px;font-size:2rem}sr-rd-content h6{font-size:28.8px;font-size:1.8rem}sr-rd-content strong{color:#ffffc5}sr-rd-content em{color:#c885f5}sr-rd-content table{width:100%;line-height:25.6px;line-height:1.6rem;border-collapse:collapse;border-spacing:0;empty-cells:show;border:1px solid #cbcbcb}sr-rd-content thead{background-color:#263238;color:#f5f5f5;text-align:left;vertical-align:bottom}sr-rd-content table td,sr-rd-content table th{border-left:1px solid #cbcbcb;border-width:0 0 0 1px;margin:0;overflow:visible;padding:.5em 1em}sr-rd-content sr-blockquote{background-color:hsla(0,0%,50%,.05);border-top-right-radius:5px;border-bottom-right-radius:5px;border-left:8px solid #979797;color:#ebebeb}.simpread-multi-root,.simpread-theme-root{color:#ebebeb;background:#222}sr-rd-title{padding-bottom:.3em;font-size:44.8px;font-size:2.8rem;font-weight:700;line-height:1.2;color:#dbdbfd;border-bottom:1px solid #eee}sr-rd-desc{margin:20px;margin-left:0;padding:5px 20px;font-size:28.8px;font-size:1.8rem;background-color:hsla(0,0%,50%,.05);color:#ebebeb;border-top-right-radius:5px;border-bottom-right-radius:5px;border-left:8px solid #979797}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{line-height:1.7;color:#ebebeb}sr-rd-content a,sr-rd-content a:link{color:#8ac9ff;text-decoration:underline}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{background-color:#2a6496;color:#fff;text-decoration:none}sr-rd-content pre{color:#e9eded;background-color:#263238}sr-rd-content li code,sr-rd-content p code{color:#caca16;background-color:transparent}sr-rd-mult{background-color:hsla(0,0%,50%,.1)}panel{background-color:#222!important}panel panel-tab span{color:#fff}panel sr-opt-gp sr-opt-label{color:rgba(108,255,240,.8);font-weight:400}panel text-field-float{color:rgba(108,255,240,.8)!important;font-weight:400!important}panel list-field{background-color:transparent!important}panel list-field:hover list-field-name{color:#fff!important;font-weight:700}panel input,panel list-field-name{color:hsla(35,10%,76%,.87)!important}panel list-view{background-color:#222!important}panel text-field input{color:rgba(108,255,240,.8)!important}panel sr-opt-gp action-label,panel switch content *{color:#fff!important}panel-tabs{border-bottom-color:#393d40!important}sr-annote{color:#333}sr-annote-sidebar *{color:hsla(36,10%,90%,.9)!important}sr-annote-sidebar-card[type=unread]{background-color:#19896e!important}sr-annote-sidebar-card:hover{box-shadow:0 10px 20px 0 rgba(60,73,82,.6)!important}sr-annote-sidebar-note,sr-annote-sidebar-options,sr-annote-sidebar-toolbars{background-color:#2a2a2a!important}sr-rd-theme-dark-comp{display:none;opacity:0}dialog-content,dialog-footer{color:#dbdbfd!important;background-color:#222!important}dialog-content *{color:#dbdbfd!important}dialog-content svg path{fill:#dbdbfd!important}dialog-content button-text{color:#dbdbfd!important}dialog-content text-field-state{border-top:none #dbdbfd!important;border-left:none #dbdbfd!important;border-right:none #dbdbfd!important;border-bottom:2px solid #dbdbfd!important}dialog-footer button-text{color:#dbdbfd!important}auto-complete list-view,dropdown list-view{color:#dbdbfd!important;background-color:#222!important}auto-complete list-field,dropdown list-field{-webkit-transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;transition:all .45s cubic-bezier(.23,1,.32,1) 0ms}auto-complete list-field[active=true],dropdown list-field[active=true]{color:#dbdbfd!important;background-color:#1b1b1b!important}auto-complete tag{background-color:#1b1b1b!important}sr-rd-theme-dark-comp{display:none}</style><style type="text/css">sr-rd-theme-mail{display:none}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{position:relative;margin-top:1em;margin-bottom:1pc;font-weight:700;line-height:1.4;text-align:left;color:#363636}sr-rd-content h1{padding-bottom:.3em;font-size:36p;line-height:1.2}sr-rd-content h2{padding-bottom:.3em;font-size:28p;line-height:1.225}sr-rd-content h3{font-size:24p;line-height:1.43}sr-rd-content h4{font-size:2p}sr-rd-content h5{font-size:16px}sr-rd-content h6{font-size:16px;color:#777}sr-rd-content ol,sr-rd-content ul{list-style-type:disc;padding:0;padding-left:2em}sr-rd-content ol ol,sr-rd-content ul ol{list-style-type:lower-roman}sr-rd-content ol ol ol,sr-rd-content ol ul ol,sr-rd-content ul ol ol,sr-rd-content ul ul ol{list-style-type:lower-alpha}sr-rd-content table{width:100%;overflow:auto;word-break:normal;word-break:keep-all}sr-rd-content table th{font-weight:700}sr-rd-content table td,sr-rd-content table th{padding:6px 13px;border:1px solid #ddd}sr-rd-content table tr{background-color:#fff;border-top:1px solid #ccc}sr-rd-content table tr:nth-child(2n){background-color:#f8f8f8}sr-rd-content sr-blockquote{border-left:4px solid #ddd}.simpread-theme-root{background-color:#fff;color:#333}.sr-header{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:left;-ms-flex-pack:left;justify-content:left;width:100%;margin:10px 0;height:41px;border-bottom:1px solid #e0e0e0;padding-bottom:10px}.sr-header,.sr-header a{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#195bf7}.sr-header a{display:-webkit-box;display:-ms-flexbox;display:flex;text-decoration:none}.sr-header .sr-name{height:41px;line-height:41px;font-size:20px;font-weight:700;text-decoration:none}.sr-header .sr-logo{display:block;width:41px;height:41px;background-repeat:no-repeat;background-position:50%;background-image:url(https://simpread-1254315611.file.myqcloud.com/favicon/favicon-32x32.png);margin-right:5px}.sr-header .sr-slogan{height:41px;line-height:44px;font-weight:700;font-size:15px}.sr-rd-footer{font-size:14px;text-align:center;color:#363636}.sr-rd-footer-group{display:-webkit-box;display:-ms-flexbox;display:flex;height:20px}.sr-rd-footer-line{width:100%;border-top:1px solid #e0e0e0}.sr-rd-footer-text{min-width:150px;line-height:0;text-align:center}.sr-rd-footer-copywrite{margin:10px 0 0;color:#363636}.sr-rd-footer-copywrite abbr{-webkit-font-feature-settings:normal;font-feature-settings:normal;font-variant:normal;text-decoration:none}.sr-rd-footer-copywrite .second{margin:10px 0}.sr-rd-footer-copywrite .third a:hover{border:none!important}.sr-rd-footer-copywrite .third a:first-child{margin-right:50px}.sr-rd-footer-copywrite .sr-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:33px;height:33px;opacity:.8;-webkit-transition:opacity .5s ease;transition:opacity .5s ease;cursor:pointer}.sr-rd-footer-copywrite .sr-icon:hover{opacity:1}.sr-rd-footer-copywrite a,.sr-rd-footer-copywrite a:link,.sr-rd-footer-copywrite a:visited{margin:0;padding:0;color:inherit;background-color:transparent;font-size:inherit!important;line-height:normal;text-decoration:none;vertical-align:baseline;vertical-align:initial;border:none!important;box-sizing:border-box}.sr-rd-footer-copywrite a:focus,.sr-rd-footer-copywrite a:hover,.sr-rd-footer a:active{color:inherit;text-decoration:none;border-bottom:1px dotted!important}.sr-rd-content-desc{margin:0;padding:0 0 0 1em;color:#363636;line-height:2;font-size:18px;border-left:4px solid hsla(0,0%,67%,.5)}sr-rd-content{font-size:16px;line-height:1.6}sr-rd-content h1,sr-rd-content h1 *,sr-rd-content h2,sr-rd-content h2 *,sr-rd-content h3,sr-rd-content h3 *,sr-rd-content h4,sr-rd-content h4 *,sr-rd-content h5,sr-rd-content h5 *,sr-rd-content h6,sr-rd-content h6 *{word-break:break-all}sr-rd-content div,sr-rd-content p{display:block;float:inherit;line-height:1.6;font-size:16px}sr-rd-content,sr-rd-content *,sr-rd-content div,sr-rd-content p{color:#363636;font-weight:400;line-height:1.8}sr-rd-content strong,sr-rd-content strong *{-webkit-animation:none 0s ease 0s 1 normal none running;animation:none 0s ease 0s 1 normal none running;-webkit-backface-visibility:visible;backface-visibility:visible;background:transparent none repeat 0 0/auto auto padding-box border-box scroll;border:medium none currentColor;border-collapse:separate;-o-border-image:none;border-image:none;border-radius:0;border-spacing:0;bottom:auto;box-shadow:none;box-sizing:content-box;caption-side:top;clear:none;clip:auto;color:#000;-webkit-columns:auto;-moz-columns:auto;columns:auto;-webkit-column-count:auto;-moz-column-count:auto;column-count:auto;-webkit-column-fill:balance;-moz-column-fill:balance;column-fill:balance;-webkit-column-gap:normal;-moz-column-gap:normal;column-gap:normal;-webkit-column-rule:medium none currentColor;-moz-column-rule:medium none currentColor;column-rule:medium none currentColor;-webkit-column-span:1;-moz-column-span:1;column-span:1;-webkit-column-width:auto;-moz-column-width:auto;column-width:auto;content:normal;counter-increment:none;counter-reset:none;cursor:auto;direction:ltr;display:inline;empty-cells:show;float:none;font-family:serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;line-height:normal;height:auto;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;list-style:disc outside none;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;orphans:2;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;-webkit-perspective:none;perspective:none;-webkit-perspective-origin:50% 50%;perspective-origin:50% 50%;position:static;right:auto;-moz-tab-size:8;-o-tab-size:8;tab-size:8;table-layout:auto;text-align:left;text-align-last:auto;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;-webkit-transform:none;transform:none;-webkit-transform-origin:50% 50% 0;transform-origin:50% 50% 0;-webkit-transform-style:flat;transform-style:flat;-webkit-transition:none 0s ease 0s;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:2;width:auto;word-spacing:normal;z-index:auto;all:initial}sr-rd-content a,sr-rd-content a:link{color:#4183c4;text-decoration:none}sr-rd-content a:active,sr-rd-content a:focus,sr-rd-content a:hover{color:#4183c4;text-decoration:underline}sr-rd-content figure{margin:0;padding:0}sr-rd-content img{display:inline-block;padding:0;height:auto;line-height:100%;max-width:50%;text-decoration:none;vertical-align:text-bottom;border-radius:10px;outline:none}sr-rd-content pre{background-color:#f7f7f7;border-radius:3px}sr-rd-content pre *{font-size:1.1px}sr-rd-content li code,sr-rd-content p code{background-color:rgba(0,0,0,.04);border-radius:3px}.simpread-multi-root{background:#f8f9fa}.sr-rd-mult{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;margin:0 0 16px;padding:16px 0 24px;width:100%;background-color:#fff;border-bottom:1px solid #e0e0e0}.sr-rd-mult .sr-rd-mult-content{padding:0 16px;overflow:auto}.sr-rd-mult .sr-rd-mult-avatar{margin:0 15px}.sr-rd-mult .sr-rd-mult-avatar span{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;max-width:75px;overflow:hidden;text-overflow:ellipsis;text-align:left;font-size:16px;font-size:1rem}.sr-rd-mult .sr-rd-mult-avatar img{margin-bottom:0;max-width:50px;max-height:50px;width:50px;height:50px;border-radius:50%}.sr-rd-mult .sr-rd-mult-avatar .sr-rd-content-center{margin:0}sr-rd-content.embed *{font-size:medium}sr-rd-content.embed img{max-width:100%}sr-rd-content.embed a,sr-rd-content.embed a:hover{color:inherit;font-size:medium}sr-rd-content.embed a:hover{background-color:inherit}sr-rd-content.embed .MathJax_Processed,sr-rd-content.embed math{display:none}sr-rd-content.embed pre{color:#000;color:initial;background-color:transparent}sr-rd-content.embed pre,sr-rd-content.embed pre *{font-size:13px!important}</style><style type="text/css">@media (pointer:coarse){sr-read{margin:20px 5%!important;min-width:0!important;max-width:90%!important}sr-rd-title{margin-top:0;font-size:2.7rem}sr-rd-content sr-blockquote,sr-rd-desc{margin:10 0!important;padding:0 0 0 10px!important;width:90%;font-size:1.8rem;font-style:normal;line-height:1.7;text-align:justify}sr-rd-content{font-size:1.75rem;font-weight:300}sr-rd-content figure{margin:0;padding:0;text-align:center}sr-rd-content a,sr-rd-content a:link,sr-rd-content li code,sr-rd-content p code{font-size:inherit}sr-rd-footer{margin-top:20px}sr-blockquote,sr-blockquote *{margin:5px!important;padding:5px!important}sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6,sr-rd-title{font-family:PingFang SC,Verdana,Helvetica Neue,Microsoft Yahei,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans-serif;color:#000;font-weight:100;line-height:1.35}sr-rd-content-h1,sr-rd-content-h2,sr-rd-content-h3,sr-rd-content-h4,sr-rd-content-h5,sr-rd-content-h6,sr-rd-content h1,sr-rd-content h2,sr-rd-content h3,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{margin-top:1.2em;margin-bottom:.6em;line-height:1.35}sr-rd-content-h1,sr-rd-content h1{font-size:1.8em}sr-rd-content-h2,sr-rd-content h2{font-size:1.6em}sr-rd-content-h3,sr-rd-content h3{font-size:1.4em}sr-rd-content-h4,sr-rd-content-h5,sr-rd-content-h6,sr-rd-content h4,sr-rd-content h5,sr-rd-content h6{font-size:1.2em}sr-rd-content-ul,sr-rd-content ul{margin-left:1.3em!important;list-style:disc}sr-rd-content-ol,sr-rd-content ol{list-style:decimal;margin-left:1.9em!important}sr-rd-content-ol ol,sr-rd-content-ol ul,sr-rd-content-ul ol,sr-rd-content-ul ul,sr-rd-content li ol,sr-rd-content li ul{margin-bottom:.8em;margin-left:2em!important}sr-rd-content img{margin:0;padding:0;border:0;max-width:100%!important;height:auto;box-shadow:0 20px 20px -10px rgba(0,0,0,.1)}sr-rd-mult{min-width:0;background-color:#fff;box-shadow:0 1px 6px rgba(32,33,36,.28);border-radius:8px}sr-rd-mult sr-rd-mult-avatar div{margin:0}sr-rd-mult sr-rd-mult-avatar .sr-rd-content-center-small{margin:7px 0!important}sr-rd-mult sr-rd-mult-avatar span{display:block}sr-rd-mult sr-rd-mult-content{padding-left:0}@media only screen and (max-device-width:1024px){.simpread-theme-root,html.simpread-theme-root{font-size:80%!important}sr-rd-mult sr-rd-mult-avatar img{width:50px;height:50px;min-width:50px;min-height:50px}toc-bg toc{width:10px!important}toc-bg:hover toc{width:auto!important}}@media only screen and (max-device-width:414px){.simpread-theme-root,html.simpread-theme-root{font-size:70%!important}sr-rd-mult sr-rd-mult-avatar img{width:30px;height:30px;min-width:30px;min-height:30px}}@media only screen and (max-device-width:320px){.simpread-theme-root,html.simpread-theme-root{font-size:90%!important}sr-rd-content p{margin-bottom:.5em}}}</style><style type="text/css">button[aria-label][data-balloon-pos]{overflow:visible}[aria-label][data-balloon-pos]{position:relative;cursor:pointer}[aria-label][data-balloon-pos]:after{text-indent:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-weight:400;font-style:normal;text-shadow:none;font-size:12px;background:hsla(0,0%,6%,.95);border-radius:2px;color:#fff;content:attr(aria-label);padding:.5em 1em;white-space:nowrap}[aria-label][data-balloon-pos]:after,[aria-label][data-balloon-pos]:before{opacity:0;pointer-events:none;-webkit-transition:all .18s ease-out .18s;transition:all .18s ease-out .18s;position:absolute;z-index:10}[aria-label][data-balloon-pos]:before{width:0;height:0;border:5px solid transparent;border-top-color:hsla(0,0%,6%,.95);content:""}[aria-label][data-balloon-pos]:hover:after,[aria-label][data-balloon-pos]:hover:before,[aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:after,[aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:before,[aria-label][data-balloon-pos][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-visible]:before{opacity:1;pointer-events:none}[aria-label][data-balloon-pos].font-awesome:after{font-family:FontAwesome,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif}[aria-label][data-balloon-pos][data-balloon-break]:after{white-space:pre}[aria-label][data-balloon-pos][data-balloon-break][data-balloon-length]:after{white-space:pre-line;word-break:break-word}[aria-label][data-balloon-pos][data-balloon-blunt]:after,[aria-label][data-balloon-pos][data-balloon-blunt]:before{-webkit-transition:none;transition:none}[aria-label][data-balloon-pos][data-balloon-pos=up]:after{margin-bottom:10px}[aria-label][data-balloon-pos][data-balloon-pos=up]:after,[aria-label][data-balloon-pos][data-balloon-pos=up]:before{bottom:100%;left:50%;-webkit-transform:translate(-50%,4px);transform:translate(-50%,4px);-webkit-transform-origin:top;transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos=up]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=up]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=up][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=up][data-balloon-visible]:before{-webkit-transform:translate(-50%);transform:translate(-50%)}[aria-label][data-balloon-pos][data-balloon-pos=up-left]:after{bottom:100%;left:0;margin-bottom:10px;-webkit-transform:translateY(4px);transform:translateY(4px);-webkit-transform-origin:top;transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos=up-left]:before{bottom:100%;left:5px;-webkit-transform:translateY(4px);transform:translateY(4px);-webkit-transform-origin:top;transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos=up-left]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=up-left]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=up-left][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=up-left][data-balloon-visible]:before{-webkit-transform:translate(0);transform:translate(0)}[aria-label][data-balloon-pos][data-balloon-pos=up-right]:after{bottom:100%;right:0;margin-bottom:10px;-webkit-transform:translateY(4px);transform:translateY(4px);-webkit-transform-origin:top;transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos=up-right]:before{bottom:100%;right:5px;-webkit-transform:translateY(4px);transform:translateY(4px);-webkit-transform-origin:top;transform-origin:top}[aria-label][data-balloon-pos][data-balloon-pos=up-right]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=up-right]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=up-right][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=up-right][data-balloon-visible]:before{-webkit-transform:translate(0);transform:translate(0)}[aria-label][data-balloon-pos][data-balloon-pos=down]:after{left:50%;margin-top:10px;top:100%;-webkit-transform:translate(-50%,-4px);transform:translate(-50%,-4px)}[aria-label][data-balloon-pos][data-balloon-pos=down]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:hsla(0,0%,6%,.95);left:50%;top:100%;-webkit-transform:translate(-50%,-4px);transform:translate(-50%,-4px)}[aria-label][data-balloon-pos][data-balloon-pos=down]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=down]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=down][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=down][data-balloon-visible]:before{-webkit-transform:translate(-50%);transform:translate(-50%)}[aria-label][data-balloon-pos][data-balloon-pos=down-left]:after{left:0;margin-top:10px;top:100%;-webkit-transform:translateY(-4px);transform:translateY(-4px)}[aria-label][data-balloon-pos][data-balloon-pos=down-left]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:hsla(0,0%,6%,.95);left:5px;top:100%;-webkit-transform:translateY(-4px);transform:translateY(-4px)}[aria-label][data-balloon-pos][data-balloon-pos=down-left]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=down-left]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=down-left][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=down-left][data-balloon-visible]:before{-webkit-transform:translate(0);transform:translate(0)}[aria-label][data-balloon-pos][data-balloon-pos=down-right]:after{right:0;margin-top:10px;top:100%;-webkit-transform:translateY(-4px);transform:translateY(-4px)}[aria-label][data-balloon-pos][data-balloon-pos=down-right]:before{width:0;height:0;border:5px solid transparent;border-bottom-color:hsla(0,0%,6%,.95);right:5px;top:100%;-webkit-transform:translateY(-4px);transform:translateY(-4px)}[aria-label][data-balloon-pos][data-balloon-pos=down-right]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=down-right]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=down-right][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=down-right][data-balloon-visible]:before{-webkit-transform:translate(0);transform:translate(0)}[aria-label][data-balloon-pos][data-balloon-pos=left]:after{margin-right:10px;right:100%;top:50%;-webkit-transform:translate(4px,-50%);transform:translate(4px,-50%)}[aria-label][data-balloon-pos][data-balloon-pos=left]:before{width:0;height:0;border:5px solid transparent;border-left-color:hsla(0,0%,6%,.95);right:100%;top:50%;-webkit-transform:translate(4px,-50%);transform:translate(4px,-50%)}[aria-label][data-balloon-pos][data-balloon-pos=left]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=left]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=left][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=left][data-balloon-visible]:before{-webkit-transform:translateY(-50%);transform:translateY(-50%)}[aria-label][data-balloon-pos][data-balloon-pos=right]:after{left:100%;margin-left:10px;top:50%;-webkit-transform:translate(-4px,-50%);transform:translate(-4px,-50%)}[aria-label][data-balloon-pos][data-balloon-pos=right]:before{width:0;height:0;border:5px solid transparent;border-right-color:hsla(0,0%,6%,.95);left:100%;top:50%;-webkit-transform:translate(-4px,-50%);transform:translate(-4px,-50%)}[aria-label][data-balloon-pos][data-balloon-pos=right]:hover:after,[aria-label][data-balloon-pos][data-balloon-pos=right]:hover:before,[aria-label][data-balloon-pos][data-balloon-pos=right][data-balloon-visible]:after,[aria-label][data-balloon-pos][data-balloon-pos=right][data-balloon-visible]:before{-webkit-transform:translateY(-50%);transform:translateY(-50%)}[aria-label][data-balloon-pos][data-balloon-length=small]:after{white-space:normal;width:80px}[aria-label][data-balloon-pos][data-balloon-length=medium]:after{white-space:normal;width:150px}[aria-label][data-balloon-pos][data-balloon-length=large]:after{white-space:normal;width:260px}[aria-label][data-balloon-pos][data-balloon-length=xlarge]:after{white-space:normal;width:380px}@media screen and (max-width:768px){[aria-label][data-balloon-pos][data-balloon-length=xlarge]:after{white-space:normal;width:90vw}}[aria-label][data-balloon-pos]:before{display:none}[aria-label][data-balloon-pos]:after{box-shadow:0 0 10px rgba(0,0,0,.3);border-radius:5px;font-weight:700;font-size:10px}[aria-label][data-balloon-pos][data-balloon-pos=up]:after{line-height:21px}[aria-label][data-balloon-pos][data-balloon-order=downleft]:after{left:120%}[aria-label][data-balloon-pos][data-balloon-order=downright]:after{right:-22px}[aria-label][data-balloon-pos][data-balloon-order=upright]:after{left:10%}</style><style type="text/css">/*!
 * Waves v0.7.5
 * http://fian.my.id/Waves
 * 
 * Copyright 2014-2016 Alfiana E. Sibuea and other contributors
 * Released under the MIT license
 * https://github.com/fians/Waves/blob/master/LICENSE
 */.md-waves-effect{position:relative;cursor:pointer;display:inline-block;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.md-waves-effect .md-waves-ripple{position:absolute;border-radius:50%;width:100px;height:100px;margin-top:-50px;margin-left:-50px;opacity:0;background:rgba(0,0,0,.2);background:-webkit-radial-gradient(rgba(0,0,0,.2) 0,rgba(0,0,0,.3) 40%,rgba(0,0,0,.4) 50%,rgba(0,0,0,.5) 60%,hsla(0,0%,100%,0) 70%);background:radial-gradient(rgba(0,0,0,.2) 0,rgba(0,0,0,.3) 40%,rgba(0,0,0,.4) 50%,rgba(0,0,0,.5) 60%,hsla(0,0%,100%,0) 70%);-webkit-transition:all .5s ease-out;transition:all .5s ease-out;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;-webkit-transform:scale(0) translate(0);transform:scale(0) translate(0);pointer-events:none}.md-waves-effect.md-waves-light .md-waves-ripple{background:hsla(0,0%,100%,.4);background:-webkit-radial-gradient(hsla(0,0%,100%,.2) 0,hsla(0,0%,100%,.3) 40%,hsla(0,0%,100%,.4) 50%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0) 70%);background:radial-gradient(hsla(0,0%,100%,.2) 0,hsla(0,0%,100%,.3) 40%,hsla(0,0%,100%,.4) 50%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0) 70%)}.md-waves-effect.md-waves-classic .md-waves-ripple{background:rgba(0,0,0,.2)}.md-waves-effect.md-waves-classic.md-waves-light .md-waves-ripple{background:hsla(0,0%,100%,.4)}.md-waves-notransition{-webkit-transition:none!important;transition:none!important}.md-waves-button,.md-waves-circle{-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-mask-image:-webkit-radial-gradient(circle,#fff 100%,#000 0)}.md-waves-button,.md-waves-button-input,.md-waves-button:hover,.md-waves-button:visited{white-space:nowrap;vertical-align:middle;cursor:pointer;border:none;outline:none;color:inherit;background-color:transparent;font-size:1em;line-height:1em;text-align:center;text-decoration:none;z-index:1}.md-waves-button{padding:.85em 1.1em;border-radius:.2em}.md-waves-button-input{margin:0;padding:.85em 1.1em}.md-waves-input-wrapper{border-radius:.2em;vertical-align:bottom}.md-waves-input-wrapper.md-waves-button{padding:0}.md-waves-input-wrapper .md-waves-button-input{position:relative;top:0;left:0;z-index:1}.md-waves-circle{text-align:center;width:2.5em;height:2.5em;line-height:2.5em;border-radius:50%}.md-waves-float{-webkit-mask-image:none;box-shadow:0 1px 1.5px 1px rgba(0,0,0,.12);-webkit-transition:all .3s;transition:all .3s}.md-waves-float:active{box-shadow:0 8px 20px 1px rgba(0,0,0,.3)}.md-waves-block{display:block}</style><style type="text/css">.simpread-font{font:300 16px/1.8 -apple-system,PingFang SC,Microsoft Yahei,Lantinghei SC,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans-serif;color:#333;text-rendering:optimizelegibility;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased}.simpread-hidden{display:none}.simpread-read-root{display:-webkit-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative;margin:0;top:-1000px;left:0;width:100%;z-index:2147483646;overflow-x:hidden;opacity:0;-webkit-transition:all 1s cubic-bezier(.23,1,.32,1) .1s;transition:all 1s cubic-bezier(.23,1,.32,1) .1s}.simpread-read-root-show{top:0}.simpread-read-root-hide{top:1000px}sr-read{display:-webkit-flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column nowrap;flex-flow:column;margin:20px 20%;min-width:400px;min-height:400px;text-align:center}read-process{position:fixed;top:0;left:0;height:3px;width:100%;background-color:#64b5f6;-webkit-transition:width 2s;transition:width 2s;z-index:20000}sr-rd-content-error{display:block;position:relative;margin:0;margin-bottom:30px;padding:25px;background-color:rgba(0,0,0,.05)}sr-rd-footer{-webkit-box-orient:vertical;-ms-flex-direction:column;flex-direction:column;font-size:14px}sr-rd-footer,sr-rd-footer-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-direction:normal}sr-rd-footer-group{-webkit-box-orient:horizontal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-rd-footer-line{width:100%;border-top:1px solid #e0e0e0}sr-rd-footer-text{min-width:150px}sr-rd-footer-copywrite{margin:10px 0 0;color:inherit}sr-rd-footer-copywrite abbr{-webkit-font-feature-settings:normal;font-feature-settings:normal;font-variant:normal;text-decoration:none}sr-rd-footer-copywrite .second{margin:10px 0}sr-rd-footer-copywrite .third a:hover{border:none!important}sr-rd-footer-copywrite .third a:first-child{margin-right:50px}sr-rd-footer-copywrite .sr-icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:33px;height:33px;opacity:.8;-webkit-transition:opacity .5s ease;transition:opacity .5s ease;cursor:pointer}sr-rd-footer-copywrite .sr-icon:hover{opacity:1}sr-rd-footer-copywrite a,sr-rd-footer-copywrite a:link,sr-rd-footer-copywrite a:visited{margin:0;padding:0;color:inherit;background-color:transparent;font-size:inherit!important;line-height:normal;text-decoration:none;vertical-align:baseline;vertical-align:initial;border:none!important;box-sizing:border-box}sr-rd-footer-copywrite a:focus,sr-rd-footer-copywrite a:hover,sr-rd-footer a:active{color:inherit;text-decoration:none;border-bottom:1px dotted!important}.simpread-blocks{text-decoration:none!important}.simpread-blocks *{margin:0}.simpread-blocks a{padding:0;text-decoration:none!important}.simpread-blocks img{margin:0;padding:0;border:0;background:transparent;box-shadow:none}.simpread-focus-root{display:block;position:fixed;top:0;left:0;right:0;bottom:0;background-color:hsla(0,0%,92%,.9);z-index:2147483645;opacity:0;-webkit-transition:opacity 1s cubic-bezier(.23,1,.32,1) 0ms;transition:opacity 1s cubic-bezier(.23,1,.32,1) 0ms}.simpread-focus-highlight{position:relative;box-shadow:0 0 0 20px #fff;background-color:#fff;overflow:visible;z-index:2147483646}.sr-controlbar-bg sr-rd-crlbar,.sr-controlbar-bg sr-rd-crlbar fab{z-index:2147483647}sr-rd-crlbar.controlbar{position:fixed;right:0;bottom:0;width:100px;height:100%;opacity:0;-webkit-transition:opacity .5s ease;transition:opacity .5s ease}sr-rd-crlbar.controlbar:hover{opacity:1}sr-rd-crlbar fap *{box-sizing:border-box}@media (max-height:620px){fab{zoom:.8}}@media (max-height:783px){dialog-gp dialog-content{max-height:580px}dialog-gp dialog-footer{border-top:1px solid #e0e0e0}}.simpread-highlight-selector{outline:3px dashed #1976d2!important;cursor:pointer!important}.simpread-highlight-controlbar,.simpread-highlight-selector{background-color:#fafafa!important;opacity:.8!important;-webkit-transition:opacity .5s ease!important;transition:opacity .5s ease!important}.simpread-highlight-controlbar{position:relative!important;border:3px dashed #1976d2!important}simpread-highlight,sr-snapshot-ctlbar{position:fixed;top:0;left:0;right:0;padding:15px;height:50px;background-color:rgba(50,50,50,.9);box-shadow:0 2px 5px rgba(0,0,0,.26);box-sizing:border-box;z-index:2147483640}simpread-highlight,sr-highlight-ctl,sr-snapshot-ctlbar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-highlight-ctl{margin:0 5px;width:50px;height:20px;color:#fff;background-color:#1976d2;border-radius:4px;box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);cursor:pointer}toc-bg{position:fixed;left:0;top:0;width:50px;height:200px;font-size:medium}toc-bg:hover{z-index:3}.toc-bg-hidden{opacity:0;-webkit-transition:opacity .5s ease;transition:opacity .5s ease}.toc-bg-hidden:hover{opacity:1;z-index:3}.toc-bg-hidden:hover toc{width:180px}toc *{all:unset}toc{position:fixed;left:0;top:100px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;padding:10px;width:0;max-width:200px;max-height:500px;overflow-x:hidden;overflow-y:hidden;cursor:pointer;border:1px solid hsla(0,0%,62%,.22);-webkit-transition:width .5s;transition:width .5s}toc:hover{overflow-y:auto}toc.mini:hover{width:200px!important}toc::-webkit-scrollbar{width:3px}toc::-webkit-scrollbar-thumb{border-radius:10px;background-color:hsla(36,2%,54%,.5)}toc outline{position:relative;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;padding:2px 0;min-height:21px;line-height:21px;text-align:left}toc outline a,toc outline a:active,toc outline a:focus,toc outline a:visited{display:block;width:100%;color:inherit;font-size:11px;text-decoration:none!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}toc outline a:hover{font-weight:700!important}toc outline a.toc-outline-theme-dark,toc outline a.toc-outline-theme-night{color:#fff!important}.toc-level-h1{padding-left:5px}.toc-level-h2{padding-left:15px}.toc-level-h3{padding-left:25px}.toc-level-h4{padding-left:35px}.toc-outline-active{border-left:2px solid #f44336}toc outline active{position:absolute;left:0;top:0;bottom:0;padding:0 0 0 3px;border-left:2px solid #e8e8e8}sr-kbd{background:-webkit-gradient(linear,0 0,0 100%,from(#fff785),to(#ffc542));border:1px solid #e3be23;-o-border-image:none;border-image:none;-o-border-image:initial;border-image:initial;position:absolute;left:0;padding:1px 3px 0;font-size:11px!important;font-weight:700;box-shadow:0 3px 7px 0 rgba(0,0,0,.3);overflow:hidden;border-radius:3px}.sr-kbd-a{position:relative}kbd-mapping{position:fixed;left:5px;bottom:5px;-ms-flex-flow:row;flex-flow:row;width:250px;height:500px;background-color:#fff;border:1px solid hsla(0,0%,62%,.22);box-shadow:0 2px 5px rgba(0,0,0,.26);border-radius:3px}kbd-mapping,kbd-maps{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}kbd-maps{margin:40px 0 20px;width:100%;overflow-x:auto}kbd-maps::-webkit-scrollbar-thumb{background-clip:padding-box;border-radius:10px;border:2px solid transparent;background-color:rgba(85,85,85,.55)}kbd-maps::-webkit-scrollbar{width:10px;-webkit-transition:width .7s cubic-bezier(.4,0,.2,1);transition:width .7s cubic-bezier(.4,0,.2,1)}kbd-mapping kbd-map-title{position:absolute;margin:5px 0;width:100%;font-size:14px;font-weight:700}kbd-maps-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}kbd-maps-title{margin:5px 0;padding-left:53px;font-size:12px;font-weight:700}kbd-map kbd{display:inline-block;padding:3px 5px;font-size:11px;line-height:10px;color:#444d56;vertical-align:middle;background-color:#fafbfc;border:1px solid #c6cbd1;border-bottom-color:#959da5;border-radius:3px;box-shadow:inset 0 -1px 0 #959da5}kbd-map kbd-name{display:inline-block;text-align:right;width:50px}kbd-map kbd-desc{padding-left:3px}sharecard-bg{position:fixed;top:0;left:0;width:100%;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:rgba(0,0,0,.4);z-index:2147483647}sharecard{max-width:450px;background-color:#64b5f6}sharecard,sharecard-head{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}sharecard-head{margin:25px;color:#fff;border-radius:10px;box-shadow:0 2px 6px 0 rgba(0,0,0,.2),0 25px 50px 0 rgba(0,0,0,.15)}sharecard-card{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}sharecard-card,sharecard-top{display:-webkit-box;display:-ms-flexbox;display:flex}sharecard-top{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding-right:5px;height:65px;background-color:#fff;color:#878787;font-size:25px;font-weight:500;border-top-left-radius:10px;border-top-right-radius:10px}sharecard-top span.logos{display:block;width:48px;height:48px;margin:5px;background-repeat:no-repeat;background-position:50%;background-image:url("");zoom:.8}sharecard-content{padding:15px;max-height:500px;font-size:20px;text-align:justify;background-color:#2196f3;overflow-x:hidden;overflow-y:auto}sharecard-via{padding:10px;font-size:10px;background-color:#2196f3}sharecard-footer{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding-right:5px;height:100px;background-color:#fff;color:#878787;font-size:15px;font-weight:500;border-bottom-left-radius:10px;border-bottom-right-radius:10px}sharecard-footer,sharecard-footer div{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sharecard-footer span.qrcode{display:block;width:100px;height:100px;margin:5px;background-repeat:no-repeat;background-position:50%;background-image:url("")}sharecard-control{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 19px;height:80px;background-color:#fff}simpread-snapshot{width:100%;height:100%;cursor:move;z-index:2147483645}simpread-snapshot,sr-mask{position:fixed;left:0;top:0}sr-mask{background-color:rgba(0,0,0,.1)}.simpread-feedback,.simpread-urlscheme{position:fixed;right:20px;bottom:20px;z-index:2147483646}simpread-feedback,simpread-urlscheme{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:20px 20px 0;width:500px;color:rgba(51,51,51,.87);background-color:#fff;border-radius:3px;box-shadow:0 0 2px rgba(0,0,0,.12),0 2px 2px rgba(0,0,0,.26);overflow:hidden;-webkit-transform-origin:bottom;transform-origin:bottom;-webkit-transition:all .6s ease;transition:all .6s ease}simpread-feedback *,simpread-urlscheme *{font-size:12px!important;box-sizing:border-box}simpread-feedback.active,simpread-urlscheme.active{-webkit-animation-name:srFadeInUp;animation-name:srFadeInUp;-webkit-animation-duration:.45s;animation-duration:.45s;-webkit-animation-fill-mode:both;animation-fill-mode:both}simpread-feedback.hide,simpread-urlscheme.hide{-webkit-animation-name:srFadeInDown;animation-name:srFadeInDown;-webkit-animation-duration:.45s;animation-duration:.45s;-webkit-animation-fill-mode:both;animation-fill-mode:both}simpread-feedback sr-fb-label,simpread-urlscheme sr-urls-label{width:100%}simpread-feedback sr-fb-head,simpread-urlscheme sr-urls-head{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;margin-bottom:5px;width:100%}simpread-feedback sr-fb-content,simpread-urlscheme sr-urls-content{margin-bottom:5px;width:100%}simpread-feedback sr-urls-footer,simpread-urlscheme sr-urls-footer{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;width:100%}simpread-feedback sr-fb-a,simpread-urlscheme sr-urls-a{color:#2163f7;cursor:pointer}simpread-feedback text-field-state,simpread-urlscheme text-field-state{border-top:none rgba(34,101,247,.8)!important;border-left:none rgba(34,101,247,.8)!important;border-right:none rgba(34,101,247,.8)!important;border-bottom:2px solid rgba(34,101,247,.8)!important}simpread-feedback switch,simpread-urlscheme switch{margin-top:0!important}@-webkit-keyframes srFadeInUp{0%{opacity:0;-webkit-transform:translateY(100px);transform:translateY(100px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes srFadeInUp{0%{opacity:0;-webkit-transform:translateY(100px);transform:translateY(100px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes srFadeInDown{0%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}to{opacity:0;-webkit-transform:translateY(100px);transform:translateY(100px)}}@keyframes srFadeInDown{0%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}to{opacity:0;-webkit-transform:translateY(100px);transform:translateY(100px)}}simpread-feedback sr-fb-head{font-weight:700}simpread-feedback sr-fb-content{-webkit-box-orient:vertical;-ms-flex-direction:column;flex-direction:column}simpread-feedback sr-fb-content,simpread-feedback sr-fb-footer{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-direction:normal}simpread-feedback sr-fb-footer{-webkit-box-orient:horizontal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;width:100%}simpread-feedback sr-close{position:absolute;right:20px;cursor:pointer;-webkit-transition:all 1s cubic-bezier(.23,1,.32,1) .1s;transition:all 1s cubic-bezier(.23,1,.32,1) .1s;z-index:200}simpread-feedback sr-close:hover{-webkit-transform:rotate(-15deg) scale(1.3);transform:rotate(-15deg) scale(1.3)}simpread-feedback sr-stars{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-top:10px}simpread-feedback sr-stars i{margin-right:10px;cursor:pointer}simpread-feedback sr-stars i svg{-webkit-transition:all 1s cubic-bezier(.23,1,.32,1) .1s;transition:all 1s cubic-bezier(.23,1,.32,1) .1s}simpread-feedback sr-stars i svg:hover{-webkit-transform:rotate(-15deg) scale(1.3);transform:rotate(-15deg) scale(1.3)}simpread-feedback sr-stars i.active svg{-webkit-transform:rotate(0) scale(1);transform:rotate(0) scale(1)}simpread-feedback sr-emojis{display:block;height:100px;overflow:hidden}simpread-feedback sr-emoji{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transition:.3s;transition:.3s}simpread-feedback sr-emoji>svg{margin:15px 0;width:70px;height:70px;-ms-flex-negative:0;flex-shrink:0}simpread-feedback sr-stars-footer{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:10px 0 20px}</style><style type="text/css">sr-opt-focus,sr-opt-read{-webkit-box-orient:vertical;-ms-flex-direction:column;flex-direction:column}sr-opt-focus,sr-opt-gp,sr-opt-read{display:-webkit-flex;-webkit-box-direction:normal;width:100%}sr-opt-gp{position:relative;-webkit-box-orient:horizontal;-ms-flex-flow:row nowrap;flex-flow:row;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;margin-bottom:25px;font-size:15px}sr-opt-gp input,sr-opt-gp textarea{font-family:DIN-Regular,Bookerly,Georgia,-apple-system,PingFang SC,Microsoft Yahei,Lantinghei SC,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans-serif!important}sr-opt-gp sr-opt-label{display:block;position:absolute;margin:-8px 0 0;font-size:14px;font-weight:700;color:rgba(0,137,123,.8);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transform:scale(.75) translateY(-8px);transform:scale(.75) translateY(-8px);-webkit-transform-origin:left top 0;transform-origin:left top 0}sr-opt-themes{display:-webkit-flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-flow:row nowrap;flex-flow:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;width:100%;margin:8px 0 17px;padding:0}sr-opt-theme{width:40px;height:20px;cursor:pointer;list-style:none;border-radius:3px;border:1px solid #212121;box-sizing:border-box;opacity:1;-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms}sr-opt-theme:hover{-webkit-transform:translateY(-1px);transform:translateY(-1px);box-shadow:0 5px 10px rgba(0,0,0,.2)}sr-opt-theme:not(:first-child){margin-left:5px}sr-opt-theme[sr-type=active]{box-shadow:0 5px 10px rgba(0,0,0,.2);border:none}sr-opt-focus text-field-float,sr-opt-read text-field-float{color:rgba(0,137,123,.8)!important}sr-opt-focus text-field-state,sr-opt-read text-field-state{border-bottom-color:rgba(0,137,123,.8)!important}sr-opt-gp svg{-webkit-animation:none 0s ease 0s 1 normal none running;animation:none 0s ease 0s 1 normal none running;-webkit-backface-visibility:visible;backface-visibility:visible;background:transparent none repeat 0 0/auto auto padding-box border-box scroll;border:medium none currentColor;border-collapse:separate;-o-border-image:none;border-image:none;border-radius:0;border-spacing:0;bottom:auto;box-shadow:none;box-sizing:content-box;caption-side:top;clear:none;clip:auto;color:#000;-webkit-columns:auto;-moz-columns:auto;columns:auto;-webkit-column-count:auto;-moz-column-count:auto;column-count:auto;-webkit-column-fill:balance;-moz-column-fill:balance;column-fill:balance;-webkit-column-gap:normal;-moz-column-gap:normal;column-gap:normal;-webkit-column-rule:medium none currentColor;-moz-column-rule:medium none currentColor;column-rule:medium none currentColor;-webkit-column-span:1;-moz-column-span:1;column-span:1;-webkit-column-width:auto;-moz-column-width:auto;column-width:auto;content:normal;counter-increment:none;counter-reset:none;cursor:auto;direction:ltr;display:inline;empty-cells:show;float:none;font-family:serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;line-height:normal;height:auto;-webkit-hyphens:none;-ms-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;list-style:disc outside none;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;orphans:2;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;-webkit-perspective:none;perspective:none;-webkit-perspective-origin:50% 50%;perspective-origin:50% 50%;position:static;right:auto;-moz-tab-size:8;-o-tab-size:8;tab-size:8;table-layout:auto;text-align:left;text-align-last:auto;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;-webkit-transform:none;transform:none;-webkit-transform-origin:50% 50% 0;transform-origin:50% 50% 0;-webkit-transform-style:flat;transform-style:flat;-webkit-transition:none 0s ease 0s;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:2;width:auto;word-spacing:normal;z-index:auto;all:initial}sr-opt-gp actions{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;width:100%}sr-opt-gp action-item{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;padding:5px 0}sr-opt-gp action-item:first-child{padding-top:10px}sr-opt-gp action-label{font-size:12px;font-weight:400;margin-left:10px}sr-opt-gp action-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}sr-opt-gp action-icon,sr-opt-gp action-rect{-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-opt-gp action-rect{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}sr-opt-gp export-icon{display:block;padding:3px;width:21px;height:21px;background-size:64%;background-position:50%;background-repeat:no-repeat;border:none;border-radius:4px}sr-opt-gp export-icon.symbol{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-opt-gp export-icon i{color:#fff;font-size:12px}sr-opt-gp action-item[action=joplin] export-icon{background-size:50%}sr-opt-gp action-item[action=focusnote] export-icon{background-size:42%}style-bar{margin-bottom:10px}style-bar sr-opt-read-adv sr-opt-gp{margin:10px 0 0}style-bar sr-opt-read-adv sr-opt-gp.large{position:relative;margin-top:25px}sr-opt-read-adv sr-opt-gp:last-child{margin-bottom:0}style-bar sr-opt-gp:last-child{margin-bottom:10px}style-bar sr-opt-read-adv sr-opt-label.row{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;pointer-events:auto;cursor:pointer}style-bar sr-opt-read-adv sr-opt-label.row,style-bar sr-opt-read-adv sr-opt-label sr-opt-icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}style-bar sr-opt-read-adv sr-opt-label sr-opt-icon{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-transform:rotate(90deg);transform:rotate(90deg);-webkit-transition:all .25s ease-out;transition:all .25s ease-out}style-bar sr-opt-read-adv sr-opt-label sr-opt-icon.open{-webkit-transform:rotate(270deg);transform:rotate(270deg)}style-bar sr-opt-read-adv.dividers{border-top:1px solid #eaeaea;border-bottom:1px solid #eaeaea}style-bar switch{margin:0!important}style-bar switch span{font-size:13px!important;font-weight:700!important}style-bar switch subtitle{font-size:12px!important}style-bar text-field textarea{resize:vertical!important}style-bar sr-opt-button{position:absolute!important;right:12px;bottom:14px;display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:3px;border-radius:50%;-webkit-transition:all .25s ease-out;transition:all .25s ease-out}style-bar sr-opt-button,style-bar sr-opt-button svg{cursor:pointer!important}style-bar text-field.hidden+sr-opt-button{opacity:0}</style><style type="text/css">notify-gp{font:300 14px -apple-system,PingFang SC,Microsoft Yahei,Lantinghei SC,Hiragino Sans GB,Microsoft Sans Serif,WenQuanYi Micro Hei,sans-serif;text-rendering:optimizelegibility;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;display:-webkit-flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column nowrap;flex-flow:column;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;position:fixed;top:0;right:0;margin:0 15px 0 0;padding:0;text-transform:none;pointer-events:none}notify-gp notify{display:-webkit-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:0;margin-top:15px;padding:14px 24px;min-width:288px;max-width:568px;min-height:48px;color:hsla(0,0%,100%,.9);background-color:#000;box-sizing:border-box;border-radius:4px;pointer-events:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0);-webkit-transform-origin:left top 0;transform-origin:left top 0;-webkit-transition:all .45s cubic-bezier(.23,1,.32,1) 0ms,opacity 1s cubic-bezier(.23,1,.32,1) 0ms;transition:all .45s cubic-bezier(.23,1,.32,1) 0ms,opacity 1s cubic-bezier(.23,1,.32,1) 0ms;box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12)}notify-gp notify-title{font-size:13px;font-weight:700}notify-gp notify-content{display:block;font-size:14px;font-weight:400;text-align:left;overflow:hidden}notify-gp notify-content a,notify-gp notify-content a:active,notify-gp notify-content a:link,notify-gp notify-content a:visited{margin:inherit;padding-bottom:5px;color:#fff;font-size:inherit;text-decoration:none;-webkit-transition:color .5s;transition:color .5s}notify-gp notify-content a:hover{margin:0;margin:initial;padding:0;padding:initial;color:inherit;font-size:inherit;text-decoration:none}notify-gp notify-i{display:none;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:0 10px 0 0;width:24px;height:24px;background-position:50%;background-repeat:no-repeat}notify-gp notify-action,notify-gp notify-cancel{display:none;margin:0 8px;max-width:80px;min-width:56px;height:36px;line-height:34px;color:#bb86fc;font-weight:500;font-size:inherit;text-transform:uppercase;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;cursor:pointer}notify-gp .notify-error notify-action,notify-gp .notify-error notify-cancel,notify-gp .notify-success notify-action,notify-gp .notify-success notify-cancel,notify-gp .notify-warning notify-action,notify-gp .notify-warning notify-cancel{color:#fff}notify-gp notify-action:active,notify-gp notify-cancel:active{border-radius:4px;background-color:rgba(98,0,238,.3)}notify-gp notify-cancel{margin:0}notify-gp notify-a{display:block;position:absolute;top:5px;right:5px;cursor:pointer}notify-gp notify-exit{display:none;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-left:5px;width:36px;height:36px;min-width:36px;min-height:36px;background-color:transparent;border-radius:50%;-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;cursor:pointer}notify-gp notify-exit:hover{background-color:hsla(0,0%,100%,.4)}notify-gp notify-exit:active{background-color:hsla(0,0%,100%,.2)}notify-gp notify-a notify-span{display:block;width:16px;height:16px;background-image:url();opacity:.9}notify-gp notify-i.holdon{display:block;margin:0 0 0 24px;width:20px;height:20px;background-image:url();cursor:pointer}notify-gp .notify-show{opacity:1;-webkit-transform:scaleY(1)!important;transform:scaleY(1)!important}notify-gp .notify-hide{-webkit-animation-name:fadeOutUp;animation-name:fadeOutUp;-webkit-animation-duration:.45s;animation-duration:.45s;-webkit-animation-fill-mode:both;animation-fill-mode:both}notify-gp .notify-success{background-color:#4caf50}notify-gp .notify-warning{background-color:#ffa000}notify-gp .notify-error{background-color:#ef5350}notify-gp .notify-info{background-color:#1976d2}notify-gp .notify-modal{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column nowrap;flex-flow:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;height:auto;max-height:200px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2)}notify-gp .notify-modal .notify-modal-content{margin-top:5px;font-size:13px;white-space:normal}notify-gp .notify-modal .notify-modal-content a{margin:0;padding:0;color:inherit;font-size:inherit;text-decoration:underline;cursor:pointer}notify-gp .notify-modal .notify-modal-content a:active,notify-gp .notify-modal .notify-modal-content a:focus,notify-gp .notify-modal .notify-modal-content a:hover,notify-gp .notify-modal .notify-modal-content a:visited{color:inherit}notify-gp .notify-snackbar{position:fixed;bottom:0;left:50%;margin-bottom:5px;-webkit-transform-origin:left bottom 0;transform-origin:left bottom 0}.notify-position-lt-corner{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;margin:0 0 0 15px;left:0;right:auto}.notify-position-lb-corner{margin:0 0 15px 15px;right:auto;left:0}.notify-position-lb-corner,.notify-position-rb-corner{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-flow:column-reverse wrap-reverse;flex-flow:column-reverse wrap-reverse;top:auto;bottom:0}.notify-position-rb-corner{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;margin:0 15px 15px 0;left:auto;right:0}@-webkit-keyframes fadeOutUp{0%{opacity:1}to{margin-top:0;padding:0;height:0;min-height:0;opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}}@keyframes fadeOutUp{0%{opacity:1}to{margin-top:0;padding:0;height:0;min-height:0;opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0)}}@media (pointer:coarse){notify-gp{top:auto;bottom:0;left:0;margin:0 10px 10px}notify-gp notify{width:100%;max-width:600px}notify-gp .notify-hide,notify-gp .notify-show{-webkit-transform-origin:bottom!important;transform-origin:bottom!important}notify-gp .notify-snackbar{position:static}}</style><style type="text/css">dialog-gp .carousel,welcome .carousel{position:relative;width:100%;height:400px;-webkit-perspective:500px;perspective:500px;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transform-origin:0 50%;transform-origin:0 50%;overflow:hidden}dialog-gp .carousel.carousel-slider,welcome .carousel.carousel-slider{top:0;left:0;height:100%}dialog-gp .carousel.carousel-slider .carousel-item,welcome .carousel.carousel-slider .carousel-item{position:absolute;top:0;left:0;width:100%;height:100%;min-height:400px}dialog-gp .carousel .carousel-item,welcome .carousel .carousel-item{display:none;position:absolute;top:0;left:0;width:200px;height:200px}dialog-gp .carousel .carousel-item>img,welcome .carousel .carousel-item>img{width:100%}dialog-gp .carousel .indicators,welcome .carousel .indicators{position:absolute;margin:0;padding:0;left:0;right:0;bottom:0;text-align:center}dialog-gp .carousel .indicators .indicator-item,welcome .carousel .indicators .indicator-item{display:inline-block;position:relative;margin:14px 4px;height:10px;width:10px;background-color:#e0e0e0;-webkit-transition:background-color .3s;transition:background-color .3s;border-radius:50%;cursor:pointer}dialog-gp .carousel .indicators .indicator-item.active,welcome .carousel .indicators .indicator-item.active{background-color:#4caf50}dialog-gp .carousel .carousel-item:not(.active) .materialboxed,dialog-gp .carousel.scrolling .carousel-item .materialboxed,welcome .carousel .carousel-item:not(.active) .materialboxed,welcome .carousel.scrolling .carousel-item .materialboxed{pointer-events:none}</style><style type="text/css">.simpread-upgrade-root *{box-sizing:border-box}.simpread-upgrade-root{-webkit-transition:all .25s ease-out;transition:all .25s ease-out}.simpread-upgrade-root.open{background-color:rgba(51,51,51,.8)}.simpread-upgrade-root dialog-gp{position:relative}.simpread-upgrade-root dialog-gp .close{position:fixed;top:0;right:0;z-index:2}.simpread-upgrade-root dialog-gp .close:hover{-webkit-transform:rotate(270deg);transform:rotate(270deg);-webkit-transition:all .25s ease-out;transition:all .25s ease-out}.simpread-upgrade-root dialog-content{padding-bottom:80px!important;overflow-y:hidden}.simpread-upgrade-root dialog-content:hover{overflow-y:overlay}.simpread-upgrade-root dialog-content::-webkit-scrollbar-track{background-color:transparent}.simpread-upgrade-root dialog-content::-webkit-scrollbar{width:12px}.simpread-upgrade-root dialog-content::-webkit-scrollbar-thumb{background-clip:padding-box;padding-top:80px;background-color:#ddd;border:3px solid transparent;border-radius:8px}.simpread-upgrade-root .floating{position:absolute;left:0;right:0;bottom:0;height:80px;overflow-y:hidden}.simpread-upgrade-root .floating,.simpread-upgrade-root .floating .billing{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.simpread-upgrade-root .floating .billing{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:1px 40px;color:#fff;background-color:#4dbb7c;font-size:15px;font-weight:400;opacity:0;border-radius:30px;-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;box-shadow:0 12px 18px -6px rgba(0,0,0,.3)}.simpread-upgrade-root .floating .billing.open{-webkit-animation-name:fadeInUp;animation-name:fadeInUp;-webkit-animation-duration:.3s;animation-duration:.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.simpread-upgrade-root .floating .billing .sales{font-size:12px}.simpread-upgrade-root .floating .billing .rate{margin:0 5px}.simpread-upgrade-root .floating .billing .price{margin-left:2px;margin-right:5px}.upgrade{position:relative;color:rgba(51,51,51,.87);font-family:Hiragino Sans GB,Microsoft Yahei;text-shadow:none}.upgrade .head{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.upgrade .head img{margin-bottom:5px;width:60px;border-radius:9px;box-shadow:0 12px 18px -6px rgba(0,0,0,.3)}.upgrade .head .title{margin:10px 0;font-weight:700;font-size:15px}.upgrade .head .desc{width:70%;text-align:center;font-size:13px}.upgrade .features{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:distribute;justify-content:space-around;-webkit-transition:height .2s cubic-bezier(.23,1,.32,1) 0ms;transition:height .2s cubic-bezier(.23,1,.32,1) 0ms}.upgrade .features.init{height:100px}.upgrade .features.init .base,.upgrade .features.init .pro{opacity:0}.upgrade .loading{position:absolute;left:0;top:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;height:100%;background-color:#fff;z-index:1}.upgrade .loading span{width:50px;height:50px;opacity:.87}.features.error{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:inherit;font-size:14px}.features.error img{margin:10px 0;width:300px}.upgrade .base,.upgrade .pro{margin:20px 20px 13px;width:100%;text-align:center;opacity:1;-webkit-transition:opacity .2s cubic-bezier(.23,1,.32,1) 0ms;transition:opacity .2s cubic-bezier(.23,1,.32,1) 0ms}.upgrade .pricecard{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border-radius:4px;border:1px solid #eef1f4;position:relative}.upgrade .pro .pricecard{border:2px solid #4dbb7c;box-shadow:0 12px 18px -6px rgba(0,0,0,.3)}.upgrade .pricecard .mode{margin:20px 10px 10px;font-size:18px;font-weight:700}.upgrade .pricecard .sales{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;height:92px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.upgrade .pricecard .discountrate{position:absolute;top:-12px;left:0;right:0}.upgrade .pricecard .discountrate .rate{padding:3px 10px;color:#fff;background-color:#4dbb7c;font-weight:700;font-size:13px;border-radius:10px}.upgrade .pricecard .desc{font-size:30px}.upgrade .pricecard .desc del{font-size:15px;font-weight:700;text-decoration:line-through}.upgrade .pricecard .price{position:relative;color:#4dbb7c;font-size:30px;font-weight:700}.upgrade .pricecard .message{position:relative;font-size:11px;font-weight:400;background-image:-webkit-linear-gradient(top,hsla(0,0%,100%,0) 50%,#ffeb3b 0);background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 50%,#ffeb3b 0)}.upgrade .pricecard .countdown{margin-top:5px}.upgrade .pricecard .billing{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:30px 20%;padding:5px;color:#333;background-color:#e2e2e2;font-size:15px;font-style:normal;font-weight:700;border-radius:4px;cursor:pointer}.upgrade .pricecard .billing,.upgrade .pricecard .billing i{-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms}.upgrade .pricecard .billing i{height:27px;line-height:22px;margin-left:5px}.upgrade .pricecard .billing:hover{box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}.upgrade .pricecard .billing:hover i{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.upgrade .pricecard .billing:hover .dropdown-price{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.upgrade .pricecard .billing .dropdown-price{position:absolute;left:-41px;top:38px;-webkit-box-orient:vertical;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:270px;color:rgba(51,51,51,.87);font-size:12px;text-shadow:none;box-sizing:border-box;border-radius:4px;box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2);opacity:0;-webkit-transform:scaleY(0);transform:scaleY(0);-webkit-transform-origin:left top 0;transform-origin:left top 0;-webkit-transition:opacity 1s cubic-bezier(.23,1,.32,1) 0ms,-webkit-transform .45s cubic-bezier(.23,1,.32,1) 0ms;transition:opacity 1s cubic-bezier(.23,1,.32,1) 0ms,-webkit-transform .45s cubic-bezier(.23,1,.32,1) 0ms;transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms,opacity 1s cubic-bezier(.23,1,.32,1) 0ms;transition:transform .45s cubic-bezier(.23,1,.32,1) 0ms,opacity 1s cubic-bezier(.23,1,.32,1) 0ms,-webkit-transform .45s cubic-bezier(.23,1,.32,1) 0ms;z-index:1}.upgrade .pricecard .billing .dropdown-price,.upgrade .pricecard .billing .dropdown-price .store{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#fff}.upgrade .pricecard .billing .dropdown-price .store{-webkit-box-orient:horizontal;-ms-flex-direction:row;flex-direction:row;padding:8px 24px 8px 16px;width:100%;-webkit-transition:all 1s cubic-bezier(.23,1,.32,1) 0ms;transition:all 1s cubic-bezier(.23,1,.32,1) 0ms;cursor:pointer}.upgrade .pricecard .billing .dropdown-price .store:hover{background-color:#eee}.upgrade .pricecard .billing .dropdown-price .store:hover i{-webkit-transform:rotate(270deg) translateY(7px);transform:rotate(270deg) translateY(7px)}.upgrade .pricecard .billing .dropdown-price .store .names{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;width:135px}.upgrade .pricecard .billing .dropdown-price .store .des{width:100%;color:rgba(51,51,51,.56);text-align:left;font-size:10px;-webkit-transform:scale(.8) translateX(-17px);transform:scale(.8) translateX(-17px)}.upgrade .pricecard .billing .dropdown-price .store .num{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:46px}.upgrade .pricecard .billing .dropdown-price .store .tips{-webkit-transform:scale(.8);transform:scale(.8);color:#4dbb7c}.upgrade .pricecard .billing .dropdown-price .store i{-webkit-transform:rotate(270deg);transform:rotate(270deg)}.upgrade .base[data-enable=false] .pricecard,.upgrade .pro[data-enable=true] .pricecard{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:210px}.upgrade .base[data-enable=false] .pricecard .mode,.upgrade .pro[data-enable=true] .pricecard .mode{font-size:25px}.upgrade .base[data-enable=false] .pricecard .billing,.upgrade .base[data-enable=false] .pricecard .sales,.upgrade .pro[data-enable=true] .pricecard .billing .dropdown-price,.upgrade .pro[data-enable=true] .pricecard .billing i,.upgrade .pro[data-enable=true] .pricecard .discountrate,.upgrade .pro[data-enable=true] .pricecard .sales{display:none}.upgrade .pro[data-enable=true] .pricecard .billing{position:absolute;top:-28px;left:0;right:0;display:inherit;margin:10px 20%;border-radius:30px}.upgrade .pro .billing{color:#fff;background-color:#4dbb7c}.upgrade .features.diff{-webkit-box-orient:vertical;-ms-flex-direction:column;flex-direction:column;margin-top:20px}.upgrade .features.diff,.upgrade .features .feature{-webkit-box-direction:normal;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.upgrade .features .feature{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:unset;-ms-flex-pack:unset;justify-content:unset;margin:14px 20px 0;font-size:15px}.upgrade .features .feature.empty{height:27px}.upgrade .features .icon{margin-right:10px;width:15px}.upgrade .features .label{width:120px;font-size:15px;text-align:left}.upgrade .features a{color:inherit;cursor:auto}.upgrade .features a.active{padding-bottom:5px;border-bottom:1px dotted;-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;cursor:pointer}.upgrade .features a.active:hover{color:#4285f4}.upgrade .features .label .remark{margin-left:5px;padding:2px 5px;background-color:#ffeb3b;font-size:12px;font-weight:400;border-radius:4px}.upgrade .features .label .remark.roadmap{background-color:#e2e2e2}.upgrade .ticket{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:13px}.upgrade .ticket .message{width:70%;text-align:center}.upgrade .ticket .line{margin:7px 0 0;width:100%;height:1px;background-image:-webkit-linear-gradient(.1deg,rgba(255,18,18,0) -2.8%,#e2e2e2 50.8%,rgba(0,159,8,0) 107.9%);background-image:linear-gradient(89.9deg,rgba(255,18,18,0) -2.8%,#e2e2e2 50.8%,rgba(0,159,8,0) 107.9%)}.upgrade .ticket .notice{margin:20px 20%;padding:5px 20px;color:#333;background-color:#e2e2e2;font-size:15px;font-weight:400;border-radius:4px}.upgrade .ticket .content{margin:0 0 13px;width:80%}.upgrade .ticket .content li{margin-bottom:6px}.upgrade .ticket .content li:last-child{margin-bottom:0}.upgrade .ticket .last{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:20px 0;width:100%}.upgrade .carousels{margin:20px 20px 13px}.upgrade .carousel.carousel-slider{height:420px;border-radius:4px;box-shadow:0 12px 18px -6px rgba(0,0,0,.3)}.upgrade .carousels setion{position:relative}.upgrade .carousels setion img{margin-top:-82px;width:100%}.upgrade .carousels .descr{position:absolute;left:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:80px;width:100%;padding-bottom:10px;background-color:#fff;font-size:17px}.simpread-upgrade-root.mini dialog-gp{border-radius:15px!important}.simpread-upgrade-root.mini dialog-content{padding:0!important;width:650px!important}.simpread-upgrade-root.mini dialog-gp .close{position:absolute}.simpread-upgrade-root.mini .upgrade .carousels{margin:0}.simpread-upgrade-root.mini .upgrade .carousels .descr{padding-bottom:70px;height:130px}.simpread-upgrade-root.mini .upgrade .carousel.carousel-slider{height:450px}.simpread-upgrade-root.mini .floating .billing{margin-bottom:30px;min-height:40px}.simpread-upgrade-root.mini footer{position:absolute;top:199px;left:-60px;right:-60px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center}</style><style type="text/css">:root{--sr-annote-color-0:#b4d9fb;--sr-annote-color-1:#ffeb3b;--sr-annote-color-2:#a2e9f2;--sr-annote-color-3:#a1e0ff;--sr-annote-color-4:#a8ea68;--sr-annote-color-5:#ffb7da}[sr-annote-bg-color]{color:inherit}[sr-annote-bg-color][data-color-type="0"]{background-color:var(--sr-annote-color-0)}[sr-annote-bg-color][data-color-type="1"]{background-color:var(--sr-annote-color-1)}[sr-annote-bg-color][data-color-type="2"]{background-color:var(--sr-annote-color-2)}[sr-annote-bg-color][data-color-type="3"]{background-color:var(--sr-annote-color-3)}[sr-annote-bg-color][data-color-type="4"]{background-color:var(--sr-annote-color-4)}[sr-annote-bg-color][data-color-type="5"]{background-color:var(--sr-annote-color-5)}[sr-annote-bb-color][data-color-type="1"]{border-bottom-color:var(--sr-annote-color-1)}[sr-annote-bb-color][data-color-type="2"]{border-bottom-color:var(--sr-annote-color-2)}[sr-annote-bb-color][data-color-type="3"]{border-bottom-color:var(--sr-annote-color-3)}[sr-annote-bb-color][data-color-type="4"]{border-bottom-color:var(--sr-annote-color-4)}[sr-annote-bb-color][data-color-type="5"]{border-bottom-color:var(--sr-annote-color-5)}[sr-annote-bl-color][data-color-type="1"]{border-left:5px solid var(--sr-annote-color-1)}[sr-annote-bl-color][data-color-type="2"]{border-left:5px solid var(--sr-annote-color-2)}[sr-annote-bl-color][data-color-type="3"]{border-left:5px solid var(--sr-annote-color-3)}[sr-annote-bl-color][data-color-type="4"]{border-left:5px solid var(--sr-annote-color-4)}[sr-annote-bl-color][data-color-type="5"]{border-left:5px solid var(--sr-annote-color-5)}[data-color-style="1"]{background-color:transparent!important;background-repeat:no-repeat;background-size:100% 100%}[data-color-style="1"][data-color-type="1"]{background-color:transparent!important;background-image:url()}[data-color-style="1"][data-color-type="2"]{background-color:transparent!important;background-image:url()}[data-color-style="1"][data-color-type="3"]{background-color:transparent!important;background-image:url()}[data-color-style="1"][data-color-type="4"]{background-color:transparent!important;background-image:url()}[data-color-style="1"][data-color-type="5"]{background-color:transparent!important;background-image:url()}[data-color-style="2"]{background-color:transparent!important}[data-color-style="2"][data-color-type="1"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 50%,var(--sr-annote-color-1) 0)}[data-color-style="2"][data-color-type="2"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 50%,var(--sr-annote-color-2) 0)}[data-color-style="2"][data-color-type="3"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 50%,var(--sr-annote-color-3) 0)}[data-color-style="2"][data-color-type="4"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 50%,var(--sr-annote-color-4) 0)}[data-color-style="2"][data-color-type="5"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 50%,var(--sr-annote-color-5) 0)}[data-color-style="3"]{position:relative;background-color:transparent!important}[data-color-style="3"]:after{content:"";position:absolute;left:0;bottom:25px;height:8px;width:58px;border-radius:4px;opacity:.8;transition:all .3s}[data-color-style="3"][data-color-type="1"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 85%,var(--sr-annote-color-1) 0)}[data-color-style="3"][data-color-type="2"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 85%,var(--sr-annote-color-2) 0)}[data-color-style="3"][data-color-type="3"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 85%,var(--sr-annote-color-3) 0)}[data-color-style="3"][data-color-type="4"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 85%,var(--sr-annote-color-4) 0)}[data-color-style="3"][data-color-type="5"]{background-color:transparent!important;background-image:linear-gradient(180deg,hsla(0,0%,100%,0) 85%,var(--sr-annote-color-5) 0)}sr-annote-note{position:relative;bottom:-5px;padding:0 4px;color:#fff;background-color:#333;font-weight:700;font-style:normal;font-family:arial,helvetica,clean,sans-serif;border-radius:5px;opacity:.8;cursor:pointer}sr-annote-note:after{content:"N"}pre.sr-annote+sr-annote-note{bottom:25px;right:25px}sr-annote-note:hover{opacity:1}sr-annote-note sr-annote-note-tip{position:absolute;left:0;top:0;padding:.5em 1em;max-width:400px;color:#fff;background:#101010;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;font-weight:400;font-style:normal;text-shadow:none;font-size:12px;text-indent:0;white-space:pre;z-index:10;border-radius:5px;box-shadow:0 0 10px rgba(0,0,0,.3);opacity:0;overflow:auto;pointer-events:none;z-index:20000;transition:all .18s ease-out .18s}sr-annote-note:hover sr-annote-note-tip{opacity:1;pointer-events:auto}sr-annote-note sr-annote-note-tip{overflow:hidden}sr-annote-note sr-annote-note-tip:hover{overflow:overlay}sr-annote-note sr-annote-note-tip::-webkit-scrollbar-track{background-color:transparent}sr-annote-note sr-annote-note-tip::-webkit-scrollbar{width:12px}sr-annote-note sr-annote-note-tip::-webkit-scrollbar-thumb{background-clip:padding-box;padding-top:80px;background-color:#ddd;border:3px solid transparent;border-radius:8px}</style><style type="text/css">.sr-annote-hideall{background-color:transparent!important;pointer-events:none}sr-annote-trigger{position:fixed!important;bottom:52px;right:32px;display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:0 0 15px;padding:0;width:40px!important;height:40px!important;line-height:40px!important;color:#fff;background-color:rgba(245,82,70,.8);border-radius:50%;cursor:pointer;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);-webkit-transition:all .5s ease-in-out 0ms;transition:all .5s ease-in-out 0ms;overflow:visible!important;overflow:initial!important}sr-annote-trigger.open{right:95px}sr-annote-trigger.off{background-color:#bdbdbd}sr-annote-trigger sr-i{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;height:100%;border-radius:50%}sr-annote{padding:6px 0;background-color:transparent;font-size:inherit;cursor:pointer}.sr-annote[data-type=code],.sr-annote[data-type=img]{border-bottom-width:5px;border-bottom-style:solid}sr-annote[data-color-type="0"]{padding:7px 0}sr-annote-floating{position:fixed;color:#fff;background:hsla(0,0%,6%,.95);font-weight:700;border-radius:5px;box-shadow:0 0 10px rgba(0,0,0,.3);opacity:0;-webkit-animation-delay:.2s;animation-delay:.2s;-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:sr-annote-slideInUp;animation-name:sr-annote-slideInUp;z-index:2000}sr-annote-floating.fast{-webkit-animation-duration:.2s!important;animation-duration:.2s!important}sr-annote-floating.effect{-webkit-transition:all 1s cubic-bezier(.23,1,.32,1) .1s;transition:all 1s cubic-bezier(.23,1,.32,1) .1s}sr-annote-floating.hidden{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-name:sr-annote-slideInDown;animation-name:sr-annote-slideInDown;pointer-events:none}.sr-annote-floatingbar-hiden{display:none}@-webkit-keyframes sr-annote-slideInUp{0%{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);visibility:visible}to{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes sr-annote-slideInUp{0%{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);visibility:visible}to{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@-webkit-keyframes sr-annote-slideInDown{0%{opacity:1;visibility:visible}to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes sr-annote-slideInDown{0%{opacity:1;visibility:visible}to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}sr-annote-floatingbar{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;margin:5px}sr-annote-floatingbar,sr-annote-floatingbar sr-anote-fb-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-annote-floatingbar sr-anote-fb-item{margin-right:5px;cursor:pointer}sr-annote-floatingbar sr-anote-fb-item:last-child{margin-right:0}sr-annote-floatingbar sr-anote-fb-item{width:20px;height:20px;border-radius:50%;box-sizing:border-box}sr-annote-floatingbar sr-anote-fb-item[type=copy],sr-annote-floatingbar sr-anote-fb-item[type=export],sr-annote-floatingbar sr-anote-fb-item[type=link],sr-annote-floatingbar sr-anote-fb-item[type=note],sr-annote-floatingbar sr-anote-fb-item[type=remove],sr-annote-floatingbar sr-anote-fb-item[type=style],sr-annote-floatingbar sr-anote-fb-item[type=tag]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#fff;border-radius:50%}sr-annote-floatingbar sr-anote-fb-item[type=style]{background-color:#f73859!important}sr-annote-floatingbar sr-anote-fb-item[type=export]{background-color:#cc0e74}sr-annote-floatingbar sr-anote-fb-item[type=copy]{background-color:#a78674}sr-annote-floatingbar sr-anote-fb-item[type=link]{background-color:#7f39fb}sr-annote-floatingbar sr-anote-fb-item[type=remove]{background-color:#f44336}sr-annote-floatingbar sr-anote-fb-item[remove=confirm]{-webkit-transform:rotate(270deg);transform:rotate(270deg);-webkit-transition:all .2s ease-in-out 0s;transition:all .2s ease-in-out 0s}sr-annote-sidebar-bg{position:fixed;top:0;right:0;bottom:180px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;width:260px;font-size:22.4px;font-size:1.4rem;font-weight:500;opacity:0;-webkit-transform:translateX(256px);transform:translateX(256px);-webkit-transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;transition:all .45s cubic-bezier(.23,1,.32,1) 0ms}sr-annote-sidebar-bg.mini{pointer-events:none}sr-annote-sidebar-bg:hover{z-index:2147483647}sr-annote-sidebar-bg.open{opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}sr-annote-sidebar{margin:3px 4px 0;padding-left:20px;height:100%;overflow-x:hidden}sr-annote-sidebar.mini{pointer-events:none}sr-annote-sidebar *{color:rgba(0,0,0,.6);word-break:break-all;box-sizing:border-box}sr-annote-sidebar{overflow-y:hidden}sr-annote-sidebar:hover{overflow-y:overlay}sr-annote-sidebar::-webkit-scrollbar-track{background-color:transparent}sr-annote-sidebar::-webkit-scrollbar{width:12px}sr-annote-sidebar::-webkit-scrollbar-thumb{padding-top:80px;background-clip:padding-box;background-color:#ddd;border:3px solid transparent;border-radius:8px;border-radius:10px;border:6px solid transparent;background-color:rgba(85,85,85,.55)}sr-annote-sidebar::-webkit-scrollbar{width:0;-webkit-transition:width .7s cubic-bezier(.4,0,.2,1);transition:width .7s cubic-bezier(.4,0,.2,1)}sr-annote-sidebar:hover::-webkit-scrollbar{width:16px}sr-annote-sidebar[srcoll=on]:hover sr-annote-sidebar-card[type=option].mini{-webkit-transform:translateX(-16px);transform:translateX(-16px)}sr-annote-sidebar[srcoll=on]:hover sr-annote-sidebar-card.off{-webkit-transform:translateX(190px);transform:translateX(190px)}sr-annote-sidebar-cards{display:block}sr-annote-sidebar-card{position:relative;display:block!important;margin:12px 7px 12px 12px;color:rgba(51,51,51,.87);background-color:#fff;border-radius:4px;box-shadow:0 2px 5px rgba(0,0,0,.08);-webkit-transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;pointer-events:auto}sr-annote-sidebar-card:hover{box-shadow:0 10px 20px 0 rgba(168,182,191,.6);-webkit-transform:translateY(-1px);transform:translateY(-1px)}sr-annote-sidebar-card:last-child{margin-bottom:30px}sr-annote-sidebar-card.off{display:block;-webkit-transform:translateX(210px);transform:translateX(210px);-webkit-transition:all .25s ease-out;transition:all .25s ease-out}sr-annote-sidebar-card.off:hover{-webkit-transform:translateX(120px)!important;transform:translateX(120px)!important}sr-annote-sidebar-card.hide{display:block;-webkit-transform:translateX(256px);transform:translateX(256px);-webkit-transition:all .25s ease-out;transition:all .25s ease-out}sr-annote-sidebar-card-anchor{position:absolute;left:0;top:0;width:90%;height:100%}sr-annote-sidebar-card-action{position:absolute;top:10px;right:3px;display:block;width:12px;height:12px;line-height:12px;-webkit-transition:all .25s ease-out;transition:all .25s ease-out;cursor:pointer;z-index:20000}sr-annote-sidebar-card-action.open{-webkit-transform:rotate(90deg);transform:rotate(90deg)}sr-annote-sidebar-card[mode=mini]{overflow:hidden}sr-annote-sidebar-card[mode=mini] sr-annote-sidebar-preview{display:block;padding:6px 12px 5px 10px;height:32px;font-size:13px;font-weight:400;white-space:nowrap;text-align:left;text-overflow:ellipsis;-webkit-transition:all .25s ease-out;transition:all .25s ease-out;overflow:hidden}sr-annote-sidebar-card[mode=mini][type=img] sr-annote-sidebar-preview{text-align:center}sr-annote-sidebar-card[mode=mini] sr-annote-sidebar-detail{padding:0 15px;height:0}sr-annote-sidebar-card[mode=mini] sr-annote-sidebar-note,sr-annote-sidebar-card[mode=mini] sr-annote-sidebar-toolbars{display:none}sr-annote-sidebar-card[mode=mini] pre{margin:0!important;padding:0!important;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}sr-annote-sidebar-card[mode=normal] sr-annote-sidebar-preview{display:none}sr-annote-sidebar-card[mode=normal] sr-annote-sidebar-detail{margin-bottom:15px;padding:15px 15px 0;height:auto;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}sr-annote-sidebar-card[data-color-type="0"]{display:none!important}sr-annote-sidebar-card pre{margin:0!important;padding:0!important;background-color:transparent!important;max-height:200px;font-size:10px;overflow:hidden}sr-annote-sidebar-card input,sr-annote-sidebar-card textarea{font-size:12px!important}sr-annote-sidebar-card img{margin:0;padding:0;max-height:100px;max-width:80%;background:#fff;border:0;border-radius:6px}sr-annote-sidebar-detail{display:block;padding:15px;width:100%;color:#fff;font-size:10px;text-align:justify;border-top-left-radius:4px;border-top-right-radius:4px;-webkit-transition:all .25s ease-out;transition:all .25s ease-out}sr-annote-sidebar-card[type=img] sr-annote-sidebar-detail{text-align:center}sr-annote-sidebar-tags{-ms-flex-wrap:wrap;flex-wrap:wrap;margin-top:15px}sr-annote-sidebar-tag,sr-annote-sidebar-tags{display:-webkit-box;display:-ms-flexbox;display:flex}sr-annote-sidebar-tag{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;padding:4px 12px 12px 0;height:22px;font-size:14px;font-size:.875rem;font-weight:700;white-space:nowrap;border-radius:16px;outline:none;cursor:pointer;overflow:hidden;-webkit-transition:all .2s ease-in-out 0s;transition:all .2s ease-in-out 0s}sr-annote-sidebar-note{display:block;padding:15px 15px 0;width:100%;background-color:#fff;text-align:justify;font-size:13px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical}sr-annote-sidebar-toolbars{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;padding-right:10px;height:32px;background-color:#fff;border-bottom-left-radius:4px;border-bottom-right-radius:4px}sr-annote-sidebar-toolbar,sr-annote-sidebar-toolbars{-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-annote-sidebar-toolbar{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-left:5px;width:20px;height:20px;line-height:20px;border-radius:50%}sr-annote-sidebar-toolbar[remove=confirm]{-webkit-transform:rotate(270deg);transform:rotate(270deg);-webkit-transition:all .2s ease-in-out 0s;transition:all .2s ease-in-out 0s}sr-annote-sidebar-toolbar[remove=confirm] svg path{fill:#f44336}sr-annote-sidebar-card[type=unread]{background-color:#1fab89}sr-annote-sidebar-card[type=unread] sr-annote-sidebar-detail.title{padding:0;text-align:left;font-size:14px}sr-annote-sidebar-card[type=unread] sr-annote-sidebar-detail.desc{padding:0 0 0 10px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;border-left:1px outset #fff;border-top-left-radius:0;border-top-right-radius:0}sr-annote-sidebar-card[type=unread] sr-annote-sidebar-tag{color:#fff}sr-annote-sidebar-card[type=unread][mode=mini] sr-annote-sidebar-preview{color:#fff;font-size:13px}sr-annote-sidebar-card[type=option]{height:32px;background-color:transparent;box-shadow:none;overflow:visible;overflow:initial}sr-annote-sidebar-card[type=option]:hover{-webkit-transform:translateY(0);transform:translateY(0)}sr-annote-sidebar-card[type=option].mini{margin-right:0}sr-annote-sidebar-card[type=option] sr-annote-sidebar-card-action,sr-annote-sidebar-card[type=option] sr-annote-sidebar-card-anchor{display:none}sr-annote-sidebar-card[type=option] sr-annote-sidebar-preview{background-color:transparent}sr-annote-sidebar-options{position:absolute;top:0;right:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding-right:5px;height:100%;background-color:#3a3a3a;border-left:10px outset #222;border-radius:4px}sr-annote-sidebar-option,sr-annote-sidebar-options{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-annote-sidebar-option{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;margin-left:5px;width:20px;height:20px;border-radius:50%;-webkit-transition:all .25s ease-out;transition:all .25s ease-out;cursor:pointer}sr-annote-sidebar-option[off=true],sr-annote-sidebar-option[side=false]:not(:first-child){width:0;margin-left:0}sr-annote-sidebar-option[off=true]~sr-annote-sidebar-option:last-child svg{-webkit-transform:rotate(180deg);transform:rotate(180deg)}sr-annote-sidebar-option[type=drag][state=on] svg path,sr-annote-sidebar-option[type=goon][state=on] svg path,sr-annote-sidebar-option[type=save][state=on] svg path{fill:#1fab89}sr-annote-sidebar-option[type=collapse][state=on] svg{-webkit-transform:rotate(90deg);transform:rotate(90deg)}sr-annote-sidebar-option[lock=true] svg path{fill:#f55246!important}sr-annote-sidebar-card[type=option]:hover~sr-annote-sidebar-card[type=unread]{z-index:-1}</style><style type="text/css">@-webkit-keyframes fadeInUp{0%{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes fadeInUp{0%{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@-webkit-keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}.sr-alertgp{position:fixed;left:0;top:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;height:100%;background-color:rgba(51,51,51,.8);z-index:2147483647}.sr-alertgp .alert{min-width:400px;min-height:400px;width:650px;background-color:#fff;border-radius:4px;box-shadow:0 14px 45px rgba(0,0,0,.247059);-webkit-animation-name:fadeInUp;animation-name:fadeInUp;-webkit-animation-duration:.8s;animation-duration:.8s;-webkit-animation-fill-mode:both;animation-fill-mode:both}.sr-alertgp .alert,.sr-alertgp .alert .loading{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.sr-alertgp .alert .loading{position:relative;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;width:100%;height:35%;background-color:transparent}.alert .loading .progress{display:block;margin:10px auto;max-width:80%;max-height:250px;width:20%}.alert .loading .progress .percentage{fill:#666;font-family:sans-serif;font-size:.5em;text-anchor:middle}.alert .loading .progress .circle-bg{fill:none;stroke:#eee;stroke-width:3.8}.alert .loading .progress .circle{fill:none;stroke-width:2.8;stroke-linecap:round;stroke:#1dba90;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}@-webkit-keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnimation{0%{opacity:0;-webkit-transform:scale(1.5);transform:scale(1.5)}to{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.sr-alertgp .alert .close{position:absolute;top:0;right:0;z-index:2}.sr-alertgp .alert .close:hover{-webkit-transform:rotate(270deg);transform:rotate(270deg);-webkit-transition:all .25s ease-out;transition:all .25s ease-out}.sr-alertgp .alert .sr-alert-icon img{max-width:650px;width:100%;-webkit-transform:scale(.7);transform:scale(.7);-webkit-transition:all .5s ease-out;transition:all .5s ease-out}.sr-alertgp .alert .actionbar{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin:20px;width:80%;height:50px;-webkit-transition:all 1s cubic-bezier(.23,1,.32,1) 0ms;transition:all 1s cubic-bezier(.23,1,.32,1) 0ms}.sr-alertgp .alert .actionbar,.sr-alertgp .alert.notification{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.sr-alertgp .alert.notification{width:500px;min-height:350px}.sr-alertgp .alert.notification[data-state=siren]{background-image:-webkit-radial-gradient(circle farthest-corner at 10% 20%,#cd212a 0,#ec5f05 90%);background-image:radial-gradient(circle farthest-corner at 10% 20%,#cd212a 0,#ec5f05 90%)}.sr-alertgp .alert.notification[data-state=lock]{background-image:-webkit-radial-gradient(circle farthest-corner at 10% 20%,#8451a1 0,rgba(132,81,161,.83) 90%);background-image:radial-gradient(circle farthest-corner at 10% 20%,#8451a1 0,rgba(132,81,161,.83) 90%)}.sr-alertgp .alert.notification[data-state=warning]{background-image:-webkit-linear-gradient(left,#f2709c,#ff9472);background-image:linear-gradient(90deg,#f2709c,#ff9472)}.sr-alertgp .alert.notification[data-state=bug]{background-image:-webkit-linear-gradient(bottom,#ad5389,#3c1053);background-image:linear-gradient(0deg,#ad5389,#3c1053)}.sr-alertgp .alert.notification[data-state=safe],.sr-alertgp .alert.notification[data-state=server]{background-color:#8ec5fc;background-image:-webkit-linear-gradient(28deg,#8ec5fc,#e0c3fc);background-image:linear-gradient(62deg,#8ec5fc,#e0c3fc)}.sr-alertgp .alert.notification .sr-alert-icon{position:relative;width:100%}.sr-alertgp .alert.notification .loading .progress{padding:5px;background-color:#fff;border-radius:50%}.sr-alertgp .alert.notification .loading .progress .circle-bg{stroke:transparent}.sr-alertgp .alert.notification .loading .progress .circle{stroke-width:1}.sr-alertgp .alert.notification[data-state=siren] .loading .progress .circle{stroke:#cd212a}.sr-alertgp .alert.notification[data-state=lock] .loading .progress .circle{stroke:#8451a1}.sr-alertgp .alert.notification[data-state=warning] .loading .progress .circle{stroke:#f2709c}.sr-alertgp .alert.notification[data-state=bug] .loading .progress .circle{stroke:#ad5389}.sr-alertgp .alert.notification[data-state=safe] .loading .progress .circle,.sr-alertgp .alert.notification[data-state=server] .loading .progress .circle{stroke:#8ec5fc}.sr-alertgp .alert.notification .content{padding:10px 70px;width:100%;color:#fff;text-align:center;font-size:28.8px;font-size:1.8rem;box-sizing:border-box}.sr-alertgp .alert.notification .flag{position:absolute;left:0;top:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;height:100%;z-index:100000}.sr-alertgp .alert.notification .flag img{width:50px}.sr-alertgp .alert.notification[data-state=lock] .flag img{width:30px}.sr-alertgp .alert.notification .flag img.swing{-webkit-transform-origin:center;transform-origin:center;-webkit-animation-name:swing;animation-name:swing;-webkit-animation-duration:1s;animation-duration:1s}.sr-alertgp .alert.notification .actionbar{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:distribute;justify-content:space-around;margin:0}.sr-alertgp .alert.notification .return{padding:5px 32px;color:#333;background-color:#fff;font-size:15px;font-weight:700;border-radius:56px}.sr-alertgp .alert.notification .return:hover{box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}@-webkit-keyframes swing{20%{-webkit-transform:rotate(15deg);transform:rotate(15deg)}40%{-webkit-transform:rotate(-10deg);transform:rotate(-10deg)}60%{-webkit-transform:rotate(5deg);transform:rotate(5deg)}80%{-webkit-transform:rotate(-5deg);transform:rotate(-5deg)}to{-webkit-transform:rotate(0deg);transform:rotate(0deg)}}@keyframes swing{20%{-webkit-transform:rotate(15deg);transform:rotate(15deg)}40%{-webkit-transform:rotate(-10deg);transform:rotate(-10deg)}60%{-webkit-transform:rotate(5deg);transform:rotate(5deg)}80%{-webkit-transform:rotate(-5deg);transform:rotate(-5deg)}to{-webkit-transform:rotate(0deg);transform:rotate(0deg)}}</style><style type="text/css">@-webkit-keyframes fadeInUp{0%{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes fadeInUp{0%{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}}@-webkit-keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes fadeOutDown{0%{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}to{opacity:0;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}sr-promo-bg{position:fixed;right:15px;bottom:15px;z-index:2147483646}sr-promo,sr-promo-notice{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:10px;color:rgba(51,51,51,.87);background-color:#fff;border-radius:4px;box-shadow:0 12px 18px -6px rgba(0,0,0,.3);overflow:hidden;-webkit-transform-origin:bottom;transform-origin:bottom;-webkit-transition:all .6s ease;transition:all .6s ease;-webkit-animation-name:fadeInUp;animation-name:fadeInUp;-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-fill-mode:both;animation-fill-mode:both}sr-promo img{width:220px;cursor:pointer}sr-promo-footer{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:10px 0 0;width:100%}sr-promo-a{padding:5px 10px;color:#fff;font-size:12px;font-weight:700;border-radius:2px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);cursor:pointer}sr-promo-a.later{background-color:#2196f3}sr-promo-a.cancel{background-color:#757575}sr-promo-tip{font-size:12px;padding:5px 10px;border-radius:2px}sr-promo-notice{position:absolute;top:10px;left:10px;right:10px;height:293px;padding-bottom:0;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;font-size:12px;border-radius:0;box-shadow:none;overflow-y:hidden}sr-promo-notice:hover{overflow-y:overlay}sr-promo-notice-title{font-weight:700;text-align:center;margin-bottom:5px;width:100%;font-size:14px}sr-promo-notice-content{margin-top:5px}</style><style type="text/css">.simpread-tipsalert-root dialog-gp{position:absolute}.simpread-tipsalert-root dialog-gp .close{position:absolute;top:0;right:0;z-index:2}.simpread-tipsalert-root dialog-content{padding:0!important;width:650px!important}.simpread-tipsalert-root .details{position:relative;color:rgba(51,51,51,.87);font-family:Hiragino Sans GB,Microsoft Yahei;text-shadow:none}.simpread-tipsalert-root .details .carousel.carousel-slider{height:450px;border-radius:4px;box-shadow:0 12px 18px -6px rgba(0,0,0,.3)}.simpread-tipsalert-root .details .carousels setion sr-div-center{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:321px;box-sizing:border-box}.simpread-tipsalert-root .details .carousels setion sr-div-center.hidden{display:none}.simpread-tipsalert-root .details .carousels setion sr-div-center img{margin-top:20px!important;height:321px;width:auto!important}.simpread-tipsalert-root .details .carousels setion sr-div-center sr-video{position:absolute;left:0;right:0;width:100%;height:321px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;z-index:2}.simpread-tipsalert-root .details .carousels setion .tipsimg.error{width:0!important;height:0!important}.simpread-tipsalert-root .details .carousels setion .tipsimg:after{content:"\F1C5" " Sorry, the image below is broken :(";font-family:Font Awesome\ 5 Free;font-weight:900;position:absolute;top:0;left:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:650px;height:100%;color:#646464;background-color:#fff;z-index:2}.simpread-tipsalert-root .details .carousels setion sr-div-center sr-video+img{opacity:.5}.simpread-tipsalert-root .details .carousels setion img{margin-top:-82px;width:100%}.simpread-tipsalert-root .details .carousels setion video{height:321px}.simpread-tipsalert-root .details .carousels setion video.active{display:block}.simpread-tipsalert-root .details .carousels .descr{position:absolute;left:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:80px;width:100%;padding-bottom:10px;background-color:#fff;font-size:14px}.simpread-tipsalert-root .details .carousels .descr b{margin:0 3px}.simpread-tipsalert-root .details .carousels .descr.large{font-size:17px}.simpread-tipsalert-root .floating{position:absolute;left:0;right:0;bottom:14px;height:80px;overflow-y:hidden}.simpread-tipsalert-root .floating,.simpread-tipsalert-root .floating .docs{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.simpread-tipsalert-root .floating .docs{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;padding:1px 40px;height:30px;color:#fff;background-color:#4dbb7c;font-size:15px;font-weight:400;border-radius:30px;-webkit-transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;transition:all .5s cubic-bezier(.23,1,.32,1) 0ms;box-shadow:0 12px 18px -6px rgba(0,0,0,.3)}.simpread-tipsalert-root footer{position:absolute;top:199px;left:-60px;right:-60px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center}</style><style type="text/css">[customscroll],[data-customscroll]{overflow-y:hidden}[customscroll]:hover,[data-customscroll]:hover{overflow-y:overlay}[customscroll]::-webkit-scrollbar-track,[data-customscroll]::-webkit-scrollbar-track{background-color:transparent}[customscroll]::-webkit-scrollbar,[data-customscroll]::-webkit-scrollbar{width:12px}[customscroll]::-webkit-scrollbar-thumb,[data-customscroll]::-webkit-scrollbar-thumb{background-clip:padding-box;padding-top:80px;background-color:#ddd;border:3px solid transparent;border-radius:8px}sr-annote-popup{display:block;padding-right:20px;width:480px;height:100%}sr-annote-popup-gp{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-bottom:25px}sr-annote-popup-div{width:100%;color:var(--text-color);text-align:left;font-weight:400}sr-annote-popup-label{color:rgba(0,137,123,.8);font-size:14px;font-weight:700;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;-webkit-transform:scale(.75) translateY(-8px);transform:scale(.75) translateY(-8px);-webkit-transform-origin:left top 0;transform-origin:left top 0}sr-annote-popup-desc{position:relative;margin:10px 0;padding:10px;background-color:var(--background-hover-color);font-size:15px;text-align:justify;font-weight:400;line-height:1.6;border-radius:4px}sr-annote-popup-desc sr-annote{background-color:transparent!important}sr-annote-popup-gp[type=img]{-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-annote-popup-gp svg path{fill:var(--active-color)!important}sr-annote-popup-gp ol,sr-annote-popup-gp ul{margin:0 0 1.2em;margin-left:1.3em;padding:0;list-style:disc}sr-annote-popup-gp ol li,sr-annote-popup-gp ul li{margin:0 0 1.2em;font-size:15px;list-style:disc}sr-annote-popup-gp a{padding:0 5px;vertical-align:baseline;vertical-align:initial}sr-annote-popup-gp a,sr-annote-popup-gp a:link{color:#463f5c;font-size:inherit;font-weight:inherit;text-decoration:underline;border:none}sr-annote-popup-gp a:hover{background:transparent}sr-annote-popup-gp img{margin:0;padding:0;max-width:50%;height:auto;background:#fff;border:0;border-radius:6px;box-shadow:0 20px 20px -10px rgba(0,0,0,.1)}sr-annote-popup-gp pre{padding:10px!important;background-color:transparent!important;max-height:400px;white-space:pre-line;word-break:break-all;border-radius:6px!important;overflow-x:hidden!important}sr-annote-popup auto-complete list-view{max-height:150px!important}sr-annote-popup list-view::-webkit-scrollbar-thumb{background-clip:padding-box;border-radius:10px;border:2px solid transparent;background-color:rgba(85,85,85,.55)}sr-annote-popup list-view::-webkit-scrollbar{width:10px;-webkit-transition:width .7s cubic-bezier(.4,0,.2,1);transition:width .7s cubic-bezier(.4,0,.2,1)}sr-annote-popup-gp sr-annote-floatingbar{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}sr-annote-popup-gp sr-annote-floatingbar sr-anote-fb-item[data-color-type]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-right:20px;width:65px;height:20px;border-radius:5px}sr-annote-popup-gp sr-annote-floatingbar sr-anote-fb-item:last-child{margin-right:0}sr-annote-popup-gp sr-anote-item{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-right:20px;padding:0 5px;width:65px;height:20px;font-size:13px;font-weight:400;border-radius:5px;-webkit-transition:all .5s ease-in-out 0ms;transition:all .5s ease-in-out 0ms}sr-annote-popup-gp sr-anote-item:last-child{margin-right:0}sr-annote-popup-gp sr-anote-item.hidden{opacity:0;pointer-events:none}sr-annote-popup-gp sr-anote-lock{position:absolute;left:0;top:-3px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:100%;height:100%;background-color:hsla(0,0%,100%,.8);z-index:1}sr-annote-popup-gp sr-anote-lock svg{margin-top:3px;cursor:pointer}</style><style type="text/css">.gu-mirror{position:fixed!important;margin:0!important;z-index:9999!important;opacity:.8;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";filter:alpha(opacity=80)}.gu-hide{display:none!important}.gu-unselectable{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.gu-transit{opacity:.2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";filter:alpha(opacity=20)}</style><style type="text/css">sr-search{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin-bottom:10px;padding:10px;font-size:13px;border:1px solid #dfe1e5;border-radius:8px}sr-search.floating{position:fixed;top:170px;right:10px;width:400px;max-height:500px;z-index:2000}sr-search.bing{margin-left:-20px;margin-right:-20px}sr-search sr-search-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:10px}sr-search sr-search-header img{margin-right:10px;width:22px}sr-search sr-search-header sr-search-span{font-weight:700}sr-search-unreader-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border-bottom:1px solid #dfe1e5;margin-bottom:5px}sr-search-content{max-height:666px;overflow-x:hidden;overflow-y:auto}sr-search-unreader-title{font-weight:700;font-size:15px;margin-bottom:5px}sr-search-unreader-create{margin-bottom:5px;color:#70757a}sr-search-unreader-desc{margin-bottom:5px}sr-search-unreader-tags{margin-bottom:5px;color:#70757a;font-size:11px;font-style:italic}sr-search-unreader-tag{margin-right:5px}sr-search-paging{width:100%;margin:10px}sr-search-paging,sr-search-paging sr-search-more{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}sr-search-paging sr-search-more{width:36px;height:36px;box-shadow:0 0 0 1px rgba(0,0,0,.04),0 4px 8px 0 rgba(0,0,0,.2);border-radius:50%;opacity:.9;cursor:pointer}sr-search-paging sr-search-more:hover{opacity:1}sr-search-paging sr-search-more.disable{cursor:no-drop}sr-search-paging sr-search-more svg{width:24px;height:24px;fill:#757575}sr-search-info{text-align:center}</style><link rel="stylesheet" type="text/css" href="./Google JavaScript Style Guide_files/prettify.css"></head>
<body onload="initStyleGuide();">
<div id="content">
<h1>Google JavaScript Style Guide</h1><div id="tocDiv" class="vertical_toc"><div class="toc_title"></div><h3 class="ignoreLink" id="toc">Table of Contents</h3><table class="columns"><tbody valign="top" class="toc"><tr><td class="two_columns"><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#introduction">1 Introduction</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#terminology-notes">1.1 Terminology notes</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#guide-notes">1.2 Guide notes</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#source-file-basics">2 Source file basics</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#file-name">2.1 File name</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-encoding">2.2 File encoding: UTF-8</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#special-characters">2.3 Special characters</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#source-file-structure">3 Source file structure</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#file-copyright">3.1 License or copyright information, if present</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-fileoverview">3.2 @fileoverview JSDoc, if present</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-goog-module">3.3 goog.module statement</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-goog-module-exports">3.3.3 goog.module Exports</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-es-modules">3.4 ES modules</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-set-test-only">3.5 goog.setTestOnly</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-goog-require">3.6 goog.require and goog.requireType statements</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#file-implementation">3.7 The file’s implementation</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#formatting">4 Formatting</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-braces">4.1 Braces</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-block-indentation">4.2 Block indentation: +2 spaces</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-statements">4.3 Statements</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-column-limit">4.4 Column limit: 80</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-line-wrapping">4.5 Line-wrapping</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-whitespace">4.6 Whitespace</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-grouping-parentheses">4.7 Grouping parentheses: recommended</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#formatting-comments">4.8 Comments</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#language-features">5 Language features</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#features-local-variable-declarations">5.1 Local variable declarations</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-array-literals">5.2 Array literals</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-object-literals">5.3 Object literals</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-classes">5.4 Classes</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-functions">5.5 Functions</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-string-literals">5.6 String literals</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-number-literals">5.7 Number literals</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-control-structures">5.8 Control structures</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-this">5.9 this</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#features-equality-checks">5.10 Equality Checks</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#disallowed-features">5.11 Disallowed features</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#naming">6 Naming</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#naming-rules-common-to-all-identifiers">6.1 Rules common to all identifiers</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#naming-rules-by-identifier-type">6.2 Rules by identifier type</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#naming-camel-case-defined">6.3 Camel case: defined</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#jsdoc">7 JSDoc</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-general-form">7.1 General form</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-markdown">7.2 Markdown</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-tags">7.3 JSDoc tags</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-line-wrapping">7.4 Line wrapping</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-top-file-level-comments">7.5 Top/file-level comments</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-class-comments">7.6 Class comments</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-enum-and-typedef-comments">7.7 Enum and typedef comments</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-method-and-function-comments">7.8 Method and function comments</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-property-comments">7.9 Property comments</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-type-annotations">7.10 Type annotations</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#jsdoc-visibility-annotations">7.11 Visibility annotations</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#policies">8 Policies</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#policies-be-consistent">8.1 Issues unspecified by Google Style: Be Consistent!</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#policies-compiler-warnings">8.2 Compiler warnings</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#policies-deprecation">8.3 Deprecation</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#policies-code-not-in-google-style">8.4 Code not in Google Style</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#policies-local-style-rules">8.5 Local style rules</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#policies-generated-code-mostly-exempt">8.6 Generated code: mostly exempt</a></dd></dl><dl><dt><a href="https://google.github.io/styleguide/jsguide.html#appendices">9 Appendices</a></dt><dd><a href="https://google.github.io/styleguide/jsguide.html#appendices-jsdoc-tag-reference">9.1 JSDoc tag reference</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#appendices-commonly-misunderstood-style-rules">9.2 Commonly misunderstood style rules</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#appendices-style-related-tools">9.3 Style-related tools</a></dd><dd><a href="https://google.github.io/styleguide/jsguide.html#appendices-legacy-exceptions">9.4 Exceptions for legacy platforms</a></dd></dl></td></tr></tbody></table></div>
<h2 id="introduction" style="left: -46px; position: relative;">1 Introduction<a href="https://google.github.io/styleguide/jsguide.html#introduction" alt="link to introduction"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<p>This document serves as the <strong>complete</strong> definition of Google’s coding standards
for source code in the JavaScript programming language. A JavaScript source file
is described as being <em>in Google Style</em> if and only if it adheres to the rules
herein.</p>

<p>Like other programming style guides, the issues covered span not only aesthetic
issues of formatting, but other types of conventions or coding standards as
well. However, this document focuses primarily on the hard-and-fast rules that
we follow universally, and avoids giving advice that isn't clearly enforceable
(whether by human or tool). </p>

<h3 id="terminology-notes" style="left: -46px; position: relative;">1.1 Terminology notes<a href="https://google.github.io/styleguide/jsguide.html#terminology-notes" alt="link to terminology-notes"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>In this document, unless otherwise clarified:</p>

<ol>
<li><p>The term <em>comment</em> always refers to <em>implementation</em> comments. We do not use
the phrase <q>documentation comments</q>, instead using the common term “JSDoc”
for both human-readable text and machine-readable annotations within
<code>/** … */</code>.</p></li>
<li><p>This Style Guide uses <a href="http://tools.ietf.org/html/rfc2119">RFC 2119</a> terminology when using the phrases <em>must</em>,
<em>must not</em>, <em>should</em>, <em>should not</em>, and <em>may</em>.  The terms <em>prefer</em> and
<em>avoid</em> correspond to <em>should</em> and <em>should not</em>, respectively.  Imperative
and declarative statements are prescriptive and correspond to <em>must</em>.</p></li>
</ol>

<p>Other <q>terminology notes</q> will appear occasionally throughout the document.</p>

<h3 id="guide-notes" style="left: -46px; position: relative;">1.2 Guide notes<a href="https://google.github.io/styleguide/jsguide.html#guide-notes" alt="link to guide-notes"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Example code in this document is <strong>non-normative</strong>. That is, while the examples
are in Google Style, they may not illustrate the <em>only</em> stylish way to represent
the code. Optional formatting choices made in examples must not be enforced as
rules.</p>

<h2 id="source-file-basics" style="left: -46px; position: relative;">2 Source file basics<a href="https://google.github.io/styleguide/jsguide.html#source-file-basics" alt="link to source-file-basics"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<h3 id="file-name" style="left: -46px; position: relative;">2.1 File name<a href="https://google.github.io/styleguide/jsguide.html#file-name" alt="link to file-name"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>File names must be all lowercase and may include underscores (<code>_</code>) or dashes
(<code>-</code>), but no additional punctuation. Follow the convention that your project
uses. Filenames’ extension must be <code>.js</code>.</p>

<h3 id="file-encoding" style="left: -46px; position: relative;">2.2 File encoding: UTF-8<a href="https://google.github.io/styleguide/jsguide.html#file-encoding" alt="link to file-encoding"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Source files are encoded in <strong>UTF-8</strong>.</p>

<h3 id="special-characters" style="left: -46px; position: relative;">2.3 Special characters<a href="https://google.github.io/styleguide/jsguide.html#special-characters" alt="link to special-characters"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="whitespace-characters" style="left: -46px; position: relative;">2.3.1 Whitespace characters<a href="https://google.github.io/styleguide/jsguide.html#whitespace-characters" alt="link to whitespace-characters"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Aside from the line terminator sequence, the ASCII horizontal space character
(0x20) is the only whitespace character that appears anywhere in a source
file. This implies that</p>

<ol>
<li><p>All other whitespace characters in string literals are escaped, and</p></li>
<li><p>Tab characters are <strong>not</strong> used for indentation.</p></li>
</ol>

<h4 id="special-escape-sequences" style="left: -46px; position: relative;">2.3.2 Special escape sequences<a href="https://google.github.io/styleguide/jsguide.html#special-escape-sequences" alt="link to special-escape-sequences"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>For any character that has a special escape sequence (<code>\'</code>, <code>\"</code>, <code>\\</code>, <code>\b</code>,
<code>\f</code>, <code>\n</code>, <code>\r</code>, <code>\t</code>, <code>\v</code>), that sequence is used rather than the
corresponding numeric escape (e.g <code>\x0a</code>, <code>\u000a</code>, or <code>\u{a}</code>). Legacy octal
escapes are never used.</p>

<h4 id="non-ascii-characters" style="left: -46px; position: relative;">2.3.3 Non-ASCII characters<a href="https://google.github.io/styleguide/jsguide.html#non-ascii-characters" alt="link to non-ascii-characters"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>For the remaining non-ASCII characters, either the actual Unicode character
(e.g. <code>∞</code>) or the equivalent hex or Unicode escape (e.g. <code>\u221e</code>) is used,
depending only on which makes the code <strong>easier to read and understand</strong>.</p>

<p class="tip">Tip: In the Unicode escape case, and occasionally even when actual Unicode
characters are used, an explanatory comment can be very helpful.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/* Best: perfectly clear even without a comment. */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> units </span><span class="pun">=</span><span class="pln"> </span><span class="str">'μs'</span><span class="pun">;</span><span class="pln">

</span><span class="com">/* Allowed: but unncessary as μ is a printable character. */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> units </span><span class="pun">=</span><span class="pln"> </span><span class="str">'\u03bcs'</span><span class="pun">;</span><span class="pln"> </span><span class="com">// 'μs'</span><span class="pln">

</span><span class="com">/* Good: use escapes for non-printable characters with a comment for clarity. */</span><span class="pln">
</span><span class="kwd">return</span><span class="pln"> </span><span class="str">'\ufeff'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> content</span><span class="pun">;</span><span class="pln">  </span><span class="com">// Prepend a byte order mark.</span></pre>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/* Poor: the reader has no idea what character this is. */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> units </span><span class="pun">=</span><span class="pln"> </span><span class="str">'\u03bcs'</span><span class="pun">;</span></pre>

<p class="tip">Tip: Never make your code less readable simply out of fear that some programs
might not handle non-ASCII characters properly. If that happens, those programs
are <strong>broken</strong> and they must be <strong>fixed</strong>.</p>

<h2 id="source-file-structure" style="left: -46px; position: relative;">3 Source file structure<a href="https://google.github.io/styleguide/jsguide.html#source-file-structure" alt="link to source-file-structure"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<p>All new source files should either be a <code>goog.module</code> file (a file containing a
<code>goog.module</code> call) or an ECMAScript (ES) module (uses <code>import</code> and <code>export</code>
statements). Files consist of the following, <strong>in order</strong>:</p>

<ol>
<li>License or copyright information, if present</li>
<li><code>@fileoverview</code> JSDoc, if present</li>
<li><code>goog.module</code> statement, if a <code>goog.module</code> file</li>
<li>ES <code>import</code> statements, if an ES module</li>
<li><code>goog.require</code> and <code>goog.requireType</code> statements</li>
<li>The file’s implementation</li>
</ol>

<p><strong>Exactly one blank line</strong> separates each section that is present, except the
file's implementation, which may be preceded by 1 or 2 blank lines.</p>

<h3 id="file-copyright" style="left: -46px; position: relative;">3.1 License or copyright information, if present<a href="https://google.github.io/styleguide/jsguide.html#file-copyright" alt="link to file-copyright"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>If license or copyright information belongs in a file, it belongs here.</p>

<h3 id="file-fileoverview" style="left: -46px; position: relative;">3.2 <code>@fileoverview</code> JSDoc, if present<a href="https://google.github.io/styleguide/jsguide.html#file-fileoverview" alt="link to file-fileoverview"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>See <a href="https://google.github.io/styleguide/jsguide.html#jsdoc-top-file-level-comments">7.5 Top/file-level comments</a> for formatting rules.</p>

<h3 id="file-goog-module" style="left: -46px; position: relative;">3.3 <code>goog.module</code> statement<a href="https://google.github.io/styleguide/jsguide.html#file-goog-module" alt="link to file-goog-module"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>All <code>goog.module</code> files must declare exactly one <code>goog.module</code> name on a single
line: lines containing a <code>goog.module</code> declaration must not be wrapped, and are
therefore an exception to the 80-column limit.</p>

<p>The entire argument to goog.module is what defines a namespace.  It is the
package name (an identifier that reflects the fragment of the directory
structure where the code lives) plus, optionally, the main class/enum/interface
that it defines concatenated to the end.</p>

<p>Example</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">module</span><span class="pun">(</span><span class="str">'search.urlHistory.UrlHistoryService'</span><span class="pun">);</span></pre>

<h4 id="naming-hierarchy" style="left: -46px; position: relative;">3.3.1 Hierarchy<a href="https://google.github.io/styleguide/jsguide.html#naming-hierarchy" alt="link to naming-hierarchy"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Module namespaces may never be named as a <em>direct</em> child of another module's
namespace.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">module</span><span class="pun">(</span><span class="str">'foo.bar'</span><span class="pun">);</span><span class="pln">   </span><span class="com">// 'foo.bar.qux' would be fine, though</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">module</span><span class="pun">(</span><span class="str">'foo.bar.baz'</span><span class="pun">);</span></pre>

<p>The directory hierarchy reflects the namespace hierarchy, so that deeper-nested
children are subdirectories of higher-level parent directories.  Note that this
implies that owners of “parent” namespace groups are necessarily aware of all
child namespaces, since they exist in the same directory.</p>

<h4 id="file-declare-legacy-namespace" style="left: -46px; position: relative;">3.3.2 <code>goog.module.declareLegacyNamespace</code><a href="https://google.github.io/styleguide/jsguide.html#file-declare-legacy-namespace" alt="link to file-declare-legacy-namespace"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The single <code>goog.module</code> statement may optionally be followed by a call to
<code>goog.module.declareLegacyNamespace();</code>. Avoid
<code>goog.module.declareLegacyNamespace()</code> when possible.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">module</span><span class="pun">(</span><span class="str">'my.test.helpers'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">module</span><span class="pun">.</span><span class="pln">declareLegacyNamespace</span><span class="pun">();</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">setTestOnly</span><span class="pun">();</span></pre>

<p><code>goog.module.declareLegacyNamespace</code> exists to ease the transition from
traditional object hierarchy-based namespaces but comes with some naming
restrictions. As the child module name must be created after the parent
namespace, this name <strong>must not</strong> be a child or parent of any other
<code>goog.module</code> (for example, <code>goog.module('parent');</code> and
<code>goog.module('parent.child');</code> cannot both exist safely, nor can
<code>goog.module('parent');</code> and <code>goog.module('parent.child.grandchild');</code>).</p>

<h3 id="file-goog-module-exports" style="left: -46px; position: relative;">3.3.3 <code>goog.module</code> Exports<a href="https://google.github.io/styleguide/jsguide.html#file-goog-module-exports" alt="link to file-goog-module-exports"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Classes, enums, functions, constants, and other symbols are exported using the
<code>exports</code> object. Exported symbols may be defined directly on the <code>exports</code>
object, or else declared locally and exported separately. Symbols are only
exported if they are meant to be used outside the module. Non-exported
module-local symbols are not declared <code>@private</code> nor do their names end with an
underscore. There is no prescribed ordering for exported and module-local
symbols.</p>

<p class="examples">Examples:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Array&lt;number&gt; */</span><span class="pln"> exportedArray </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> </span><span class="lit">3</span><span class="pun">];</span><span class="pln">

</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Array&lt;number&gt; */</span><span class="pln"> moduleLocalArray </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">5</span><span class="pun">,</span><span class="pln"> </span><span class="lit">6</span><span class="pun">];</span><span class="pln">

</span><span class="com">/** @return {number} */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> moduleLocalFunction</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> moduleLocalArray</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/** @return {number} */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> exportedFunction</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> moduleLocalFunction</span><span class="pun">()</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">2</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

exports </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">exportedArray</span><span class="pun">,</span><span class="pln"> exportedFunction</span><span class="pun">};</span></pre>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @const {number} */</span><span class="pln">
exports</span><span class="pun">.</span><span class="pln">CONSTANT_ONE </span><span class="pun">=</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span><span class="pln">

</span><span class="com">/** @const {string} */</span><span class="pln">
exports</span><span class="pun">.</span><span class="pln">CONSTANT_TWO </span><span class="pun">=</span><span class="pln"> </span><span class="str">'Another constant'</span><span class="pun">;</span></pre>

<p>Do not annotate the <code>exports</code> object as <code>@const</code> as it is already treated as a
constant by the compiler.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">/** @const */</span><span class="pln">
exports </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">exportedFunction</span><span class="pun">};</span></pre>

<p><span id="file-es6-modules"></span></p>

<h3 id="file-es-modules" style="left: -46px; position: relative;">3.4 ES modules<a href="https://google.github.io/styleguide/jsguide.html#file-es-modules" alt="link to file-es-modules"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p><span id="es6-module-imports"></span></p>

<h4 id="es-module-imports" style="left: -46px; position: relative;">3.4.1 Imports<a href="https://google.github.io/styleguide/jsguide.html#es-module-imports" alt="link to es-module-imports"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Import statements must not be line wrapped and are therefore an exception to the
80-column limit.</p>

<p><span id="es6-import-paths"></span></p>

<h5 id="esm-import-paths">3.4.1.1 Import paths</h5>

<p>ES module files must use the <code>import</code> statement to import other ES module
files. Do not <code>goog.require</code> another ES module.</p>

<pre class="language-js prettyprint external prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="str">'./sideeffects.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as goog </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../closure/goog/goog.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as parent </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../parent.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">{</span><span class="pln">name</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./sibling.js'</span><span class="pun">;</span></pre>

<p><span id="es6-import-paths-file-extension"></span></p>

<h6 id="esm-import-paths-file-extension">3.4.1.1.1 File extensions in import paths</h6>

<p>The <code>.js</code> file extension is not optional in import paths and must always be
included.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="str">'../directory/file'</span><span class="pun">;</span></pre>

<pre class="language-js good prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="str">'../directory/file.js'</span><span class="pun">;</span></pre>

<h5 id="importing-the-same-file-multiple-times">3.4.1.2 Importing the same file multiple times</h5>

<p>Do not import the same file multiple times. This can make it hard to determine
the aggregate imports of a file.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// Imports have the same path, but since it doesn't align it can be hard to see.</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">{</span><span class="kwd">short</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./long/path/to/a/file.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">{</span><span class="pln">aLongNameThatBreaksAlignment</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./long/path/to/a/file.js'</span><span class="pun">;</span></pre>

<p><span id="naming-es6-imports"></span></p>

<h5 id="naming-esm-imports">3.4.1.3 Naming imports</h5>

<h6 id="naming-module-imports">3.4.1.3.1 Naming module imports</h6>

<p>Module import names (<code>import * as name</code>) are <code>lowerCamelCase</code> names that are
derived from the imported file name.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as fileOne </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../file-one.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as fileTwo </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../file_two.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as fileThree </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../filethree.js'</span><span class="pun">;</span></pre>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as libString </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./lib/string.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as math </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./math/math.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as vectorMath </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./vector/math.js'</span><span class="pun">;</span></pre>

<h6 id="naming-default-imports">3.4.1.3.2 Naming default imports</h6>

<p>Default import names are derived from the imported file name and follow the
rules in <a href="https://google.github.io/styleguide/jsguide.html#naming-rules-by-identifier-type">6.2 Rules by identifier type</a>.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../my-class.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> myFunction </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../my_function.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> SOME_CONSTANT </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../someconstant.js'</span><span class="pun">;</span></pre>

<p class="note">Note: In general this should not happen as default exports are banned by this
style guide, see <a href="https://google.github.io/styleguide/jsguide.html#named-vs-default-exports">3.4.2.1 Named vs default exports</a>. Default imports are only used
to import modules that do not conform to this style guide.</p>

<h6 id="naming-named-imports">3.4.1.3.3 Naming named imports</h6>

<p>In general symbols imported via the named import (<code>import {name}</code>) should keep
the same name. Avoid aliasing imports (<code>import {SomeThing as SomeOtherThing}</code>).
Prefer fixing name collisions by using a module import (<code>import *</code>) or renaming
the exports themselves.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as bigAnimals </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./biganimals.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as domesticatedAnimals </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./domesticatedanimals.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">new</span><span class="pln"> bigAnimals</span><span class="pun">.</span><span class="typ">Cat</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">new</span><span class="pln"> domesticatedAnimals</span><span class="pun">.</span><span class="typ">Cat</span><span class="pun">();</span></pre>

<p>If renaming a named import is needed then use components of the imported
module's file name or path in the resulting alias.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">{</span><span class="typ">Cat</span><span class="pln"> as </span><span class="typ">BigCat</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./biganimals.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">{</span><span class="typ">Cat</span><span class="pln"> as </span><span class="typ">DomesticatedCat</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./domesticatedanimals.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">BigCat</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">DomesticatedCat</span><span class="pun">();</span></pre>

<p><span id="es6-module-exports"></span></p>

<h4 id="es-module-exports" style="left: -46px; position: relative;">3.4.2 Exports<a href="https://google.github.io/styleguide/jsguide.html#es-module-exports" alt="link to es-module-exports"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Symbols are only exported if they are meant to be used outside the module.
Non-exported module-local symbols are not declared <code>@private</code> nor do their names
end with an underscore. There is no prescribed ordering for exported and
module-local symbols.</p>

<h5 id="named-vs-default-exports">3.4.2.1 Named vs default exports</h5>

<p>Use named exports in all code. You can apply the <code>export</code> keyword to a
declaration, or use the <code>export {name};</code> syntax.</p>

<p>Do not use default exports. Importing modules must give a name to these values,
which can lead to inconsistencies in naming across modules.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// Do not use default exports:</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">default</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="com">// BAD!</span></pre>

<pre class="language-js good prettyprint prettyprinted" style=""><span class="com">// Use named exports:</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span></pre>

<pre class="language-js good prettyprint prettyprinted" style=""><span class="com">// Alternate style named exports:</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span><span class="pln">

</span><span class="kwd">export</span><span class="pln"> </span><span class="pun">{</span><span class="typ">Foo</span><span class="pun">};</span></pre>

<h5 id="exporting-static-containers">3.4.2.2 Exporting static container classes and objects</h5>

<p>Do not export container classes or objects with static methods or properties for
the sake of namespacing.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// container.js</span><span class="pln">
</span><span class="com">// Bad: Container is an exported class that has only static methods and fields.</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Container</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @return {number} */</span><span class="pln">
  </span><span class="kwd">static</span><span class="pln"> bar</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/** @const {number} */</span><span class="pln">
</span><span class="typ">Container</span><span class="pun">.</span><span class="pln">FOO </span><span class="pun">=</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span></pre>

<p>Instead, export individual constants and functions:</p>

<pre class="language-js good prettyprint prettyprinted" style=""><span class="com">/** @return {number} */</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> bar</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** number */</span><span class="pln"> FOO </span><span class="pun">=</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span></pre>

<p><span id="es6-exports-mutability"></span></p>

<h5 id="esm-exports-mutability">3.4.2.3 Mutability of exports</h5>

<p>Exported variables must not be mutated outside of module initialization.</p>

<p>There are alternatives if mutation is needed, including exporting a constant
reference to an object that has mutable fields or exporting accessor functions for
mutable data.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// Bad: both foo and mutateFoo are exported and mutated.</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">let</span><span class="pln"> </span><span class="com">/** number */</span><span class="pln"> foo </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">

</span><span class="com">/**
 * Mutates foo.
 */</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> mutateFoo</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="pun">++</span><span class="pln">foo</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/**
 * @param {function(number): number} newMutateFoo
 */</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> setMutateFoo</span><span class="pun">(</span><span class="pln">newMutateFoo</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// Exported classes and functions can be mutated!</span><span class="pln">
  mutateFoo </span><span class="pun">=</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    foo </span><span class="pun">=</span><span class="pln"> newMutateFoo</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">);</span><span class="pln">
  </span><span class="pun">};</span><span class="pln">
</span><span class="pun">}</span></pre>

<pre class="language-js good prettyprint prettyprinted" style=""><span class="com">// Good: Rather than export the mutable variables foo and mutateFoo directly,</span><span class="pln">
</span><span class="com">// instead make them module scoped and export a getter for foo and a wrapper for</span><span class="pln">
</span><span class="com">// mutateFooFunc.</span><span class="pln">
</span><span class="kwd">let</span><span class="pln"> </span><span class="com">/** number */</span><span class="pln"> foo </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">let</span><span class="pln"> </span><span class="com">/** function(number): number */</span><span class="pln"> mutateFooFunc </span><span class="pun">=</span><span class="pln"> foo </span><span class="pun">=&gt;</span><span class="pln"> foo </span><span class="pun">+</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span><span class="pln">

</span><span class="com">/** @return {number} */</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> getFoo</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> foo</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> mutateFoo</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  foo </span><span class="pun">=</span><span class="pln"> mutateFooFunc</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/** @param {function(number): number} mutateFoo */</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> setMutateFoo</span><span class="pun">(</span><span class="pln">mutateFoo</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  mutateFooFunc </span><span class="pun">=</span><span class="pln"> mutateFoo</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span></pre>

<p><span id="es6-module-circular-dependencies"></span></p>

<h5 id="es-module-export-from">3.4.2.4 export from</h5>

<p><code>export from</code> statements must not be line wrapped and are therefore an
exception to the 80-column limit. This applies to both <code>export from</code> flavors.</p>

<pre class="language-js">export {specificName} from './other.js';
export * from './another.js';
</pre>

<h4 id="es-module-circular-dependencies" style="left: -46px; position: relative;">3.4.3 Circular Dependencies in ES modules<a href="https://google.github.io/styleguide/jsguide.html#es-module-circular-dependencies" alt="link to es-module-circular-dependencies"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not create cycles between ES modules, even though the ECMAScript
specification allows this. Note that it is possible to create cycles with both
the <code>import</code> and <code>export</code> statements.</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// a.js</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="str">'./b.js'</span><span class="pun">;</span></pre>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// b.js</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="str">'./a.js'</span><span class="pun">;</span><span class="pln">

</span><span class="com">// `export from` can cause circular dependencies too!</span><span class="pln">
</span><span class="kwd">export</span><span class="pln"> </span><span class="pun">{</span><span class="pln">x</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./c.js'</span><span class="pun">;</span></pre>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// c.js</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="str">'./b.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">let</span><span class="pln"> x</span><span class="pun">;</span></pre>

<p><span id="es6-module-closure-interop"></span></p>

<h4 id="es-module-closure-interop" style="left: -46px; position: relative;">3.4.4 Interoperating with Closure<a href="https://google.github.io/styleguide/jsguide.html#es-module-closure-interop" alt="link to es-module-closure-interop"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p><span id="es6-module-referencing-goog"></span></p>

<h5 id="es-module-referencing-goog">3.4.4.1 Referencing goog</h5>

<p>To reference the Closure <code>goog</code> namespace, import Closure's <code>goog.js</code>.</p>

<pre class="language-js good prettyprint external prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as goog </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../closure/goog/goog.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">const</span><span class="pln"> name </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'a.name'</span><span class="pun">);</span><span class="pln">

</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">const</span><span class="pln"> CONSTANT </span><span class="pun">=</span><span class="pln"> name</span><span class="pun">.</span><span class="pln">compute</span><span class="pun">();</span></pre>

<p><code>goog.js</code> exports only a subset of properties from the global <code>goog</code> that can be
used in ES modules.</p>

<p><span id="goog-require-in-es6-module"></span></p>

<h5 id="goog-require-in-es-module">3.4.4.2 goog.require in ES modules</h5>

<p><code>goog.require</code> in ES modules works as it does in <code>goog.module</code> files. You can
require any Closure namespace symbol (i.e., symbols created by <code>goog.provide</code> or
<code>goog.module</code>) and <code>goog.require</code> will return the value.</p>

<pre class="language-js prettyprint external prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as goog </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../closure/goog/goog.js'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as anEsModule </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'./anEsModule.js'</span><span class="pun">;</span><span class="pln">

</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">GoogPromise</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.Promise'</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> myNamespace </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'my.namespace'</span><span class="pun">);</span></pre>

<p><span id="closure-module-id-in-es6-module"></span></p>

<h5 id="closure-module-id-in-es-module">3.4.4.3 Declaring Closure Module IDs in ES modules</h5>

<p><code>goog.declareModuleId</code> can be used within ES modules to declare a
<code>goog.module</code>-like module ID. This means that this module ID can be
<code>goog.require</code>d, <code>goog.module.get</code>d, <code>goog.forwardDeclare</code>'d, etc. as if it were
a <code>goog.module</code> that did not call <code>goog.module.declareLegacyNamespace</code>. It does
not create the module ID as a globally available JavaScript symbol.</p>

<p>A <code>goog.require</code> (or <code>goog.module.get</code>) for a module ID from
<code>goog.declareModuleId</code> will always return the module object (as if it was
<code>import *</code>'d). As a result, the argument to <code>goog.declareModuleId</code> should always
end with a <code>lowerCamelCaseName</code>.</p>

<p class="note">Note: It is an error to call <code>goog.module.declareLegacyNamespace</code> in an ES
module, it can only be called from <code>goog.module</code> files. There is no direct way
to associate a <q>legacy</q> namespace with an ES module.</p>

<p><code>goog.declareModuleId</code> should only be used to upgrade Closure files to ES
modules in place, where named exports are used.</p>

<pre class="language-js prettyprint external prettyprinted" style=""><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> as goog </span><span class="kwd">from</span><span class="pln"> </span><span class="str">'../closure/goog.js'</span><span class="pun">;</span><span class="pln">

goog</span><span class="pun">.</span><span class="pln">declareModuleId</span><span class="pun">(</span><span class="str">'my.esm'</span><span class="pun">);</span><span class="pln">

</span><span class="kwd">export</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Class</span><span class="pln"> </span><span class="pun">{};</span></pre>

<h3 id="file-set-test-only" style="left: -46px; position: relative;">3.5 <code>goog.setTestOnly</code><a href="https://google.github.io/styleguide/jsguide.html#file-set-test-only" alt="link to file-set-test-only"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>In a <code>goog.module</code> file the <code>goog.module</code> statement may optionally be followed
by a call to <code>goog.setTestOnly()</code>.</p>

<p>In an ES module the <code>import</code> statements may optionally be followed by a call to
<code>goog.setTestOnly()</code>.</p>

<h3 id="file-goog-require" style="left: -46px; position: relative;">3.6 <code>goog.require</code> and <code>goog.requireType</code> statements<a href="https://google.github.io/styleguide/jsguide.html#file-goog-require" alt="link to file-goog-require"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Imports are done with <code>goog.require</code> and <code>goog.requireType</code> statements. The
names imported by a <code>goog.require</code> statement may be used both in code and in
type annotations, while those imported by a <code>goog.requireType</code> may be used
in type annotations only.</p>

<p>The <code>goog.require</code> and <code>goog.requireType</code> statements form a contiguous block
with no empty lines. This block follows the <code>goog.module</code> declaration separated
<a href="https://google.github.io/styleguide/jsguide.html#source-file-structure">by a single empty line</a>. The entire argument to
<code>goog.require</code> or <code>goog.requireType</code> is a namespace defined by a <code>goog.module</code>
in a separate file. <code>goog.require</code> and <code>goog.requireType</code> statements may not
appear anywhere else in the file.</p>

<p>Each <code>goog.require</code> or <code>goog.requireType</code> is assigned to a single constant
alias, or else destructured into several constant aliases. These aliases are the
only acceptable way to refer to dependencies in type annotations or code. Fully
qualified namespaces must not be used anywhere, except as an argument to
<code>goog.require</code> or <code>goog.requireType</code>.</p>

<p class="exception"><strong>Exception</strong>: Types, variables, and functions declared in externs files have to
use their fully qualified name in type annotations and code.</p>

<p>Aliases must match the final dot-separated component of the imported module's
namespace.</p>

<p class="exception"><strong>Exception</strong>: In certain cases, additional components of the namespace can be
used to form a longer alias. The resulting alias must retain the original
identifier's casing such that it still correctly identifies its type. Longer
aliases may be used to disambiguate otherwise identical aliases, or if it
significantly improves readability. In addition, a longer alias must be used to
prevent masking native types such as <code>Element</code>, <code>Event</code>, <code>Error</code>, <code>Map</code>, and
<code>Promise</code> (for a more complete list, see <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects">Standard Built-in Objects</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/API">Web
APIs</a> at MDN). When renaming destructured aliases, a space must follow the colon
as required in <a href="https://google.github.io/styleguide/jsguide.html#formatting-horizontal-whitespace">4.6.2 Horizontal whitespace</a>.</p>

<p>A file should not contain both a <code>goog.require</code> and a <code>goog.requireType</code>
statement for the same namespace. If the imported name is used both in code and
in type annotations, it should be imported by a single <code>goog.require</code> statement.</p>

<p>If a module is imported only for its side effects, the call must be a
<code>goog.require</code> (not a <code>goog.requireType</code>) and assignment may be omitted. A
comment is required to explain why this is needed and suppress a compiler
warning.</p>



<p>The lines are sorted according to the following rules: All requires with a name
on the left hand side come first, sorted alphabetically by those names. Then
destructuring requires, again sorted by the names on the left hand side.
Finally, any require calls that are standalone (generally these are for modules
imported just for their side effects).</p>

<p class="tip">Tip: There’s no need to memorize this order and enforce it manually. You can
rely on your IDE to report requires
that are not sorted correctly.</p>

<p>If a long alias or module name would cause a line to exceed the 80-column limit,
it <strong>must not</strong> be wrapped: require lines are an exception to the 80-column
limit.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">// Standard alias style.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'some.package.MyClass'</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">MyType</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">requireType</span><span class="pun">(</span><span class="str">'some.package.MyType'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Namespace-based alias used to disambiguate.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">NsMyClass</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'other.ns.MyClass'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Namespace-based alias used to prevent masking native type.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">RendererElement</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'web.renderer.Element'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Out of sequence namespace-based aliases used to improve readability.</span><span class="pln">
</span><span class="com">// Also, require lines longer than 80 columns must not be wrapped.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">SomeDataStructureModel</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">requireType</span><span class="pun">(</span><span class="str">'identical.package.identifiers.models.SomeDataStructure'</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">SomeDataStructureProto</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'proto.identical.package.identifiers.SomeDataStructure'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Standard alias style.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> asserts </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.asserts'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Namespace-based alias used to disambiguate.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> testingAsserts </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.testing.asserts'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Standard destructuring into aliases.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">{</span><span class="pln">clear</span><span class="pun">,</span><span class="pln"> clone</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.array'</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">{</span><span class="typ">Rgb</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.color'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Namespace-based destructuring into aliases in order to disambiguate.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">{</span><span class="typ">SomeType</span><span class="pun">:</span><span class="pln"> </span><span class="typ">FooSomeType</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">requireType</span><span class="pun">(</span><span class="str">'foo.types'</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">{</span><span class="pln">clear</span><span class="pun">:</span><span class="pln"> objectClear</span><span class="pun">,</span><span class="pln"> clone</span><span class="pun">:</span><span class="pln"> objectClone</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.object'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// goog.require without an alias in order to trigger side effects.</span><span class="pln">
</span><span class="com">/** @suppress {extraRequire} Initializes MyFramework. */</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'my.framework.initialization'</span><span class="pun">);</span></pre>

<p class="discouraged">Discouraged:</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// If necessary to disambiguate, prefer PackageClass over SomeClass as it is</span><span class="pln">
</span><span class="com">// closer to the format of the module name.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">SomeClass</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'some.package.Class'</span><span class="pun">);</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="com">// Extra terms must come from the namespace.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">MyClassForBizzing</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'some.package.MyClass'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Alias must include the entire final namespace component.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'some.package.MyClassForBizzing'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Alias must not mask native type (should be `const JspbMap` here).</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">Map</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'jspb.Map'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Don't break goog.require lines over 80 columns.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">SomeDataStructure</span><span class="pln"> </span><span class="pun">=</span><span class="pln">
    goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'proto.identical.package.identifiers.SomeDataStructure'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Alias must be based on the namespace.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> randomName </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'something.else'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// Missing a space after the colon.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">{</span><span class="typ">Foo</span><span class="pun">:</span><span class="typ">FooProto</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'some.package.proto.Foo'</span><span class="pun">);</span><span class="pln">
</span><span class="com">// goog.requireType without an alias.</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">requireType</span><span class="pun">(</span><span class="str">'some.package.with.a.Type'</span><span class="pun">);</span><span class="pln">


</span><span class="com">/**
 * @param {!some.unimported.Dependency} param All external types used in JSDoc
 *     annotations must be goog.require'd, unless declared in externs.
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> someFunction</span><span class="pun">(</span><span class="pln">param</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// goog.require lines must be at the top level before any other code.</span><span class="pln">
  </span><span class="kwd">const</span><span class="pln"> alias </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'my.long.name.alias'</span><span class="pun">);</span><span class="pln">
  </span><span class="com">// ...</span><span class="pln">
</span><span class="pun">}</span></pre>

<h3 id="file-implementation" style="left: -46px; position: relative;">3.7 The file’s implementation<a href="https://google.github.io/styleguide/jsguide.html#file-implementation" alt="link to file-implementation"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>The actual implementation follows after all dependency information is declared
(separated by at least one blank line).</p>

<p>This may consist of any module-local declarations (constants, variables,
classes, functions, etc), as well as any exported symbols.
</p>

<h2 id="formatting" style="left: -46px; position: relative;">4 Formatting<a href="https://google.github.io/styleguide/jsguide.html#formatting" alt="link to formatting"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<p><strong>Terminology Note</strong>: <em>block-like construct</em> refers to the body of a class,
function, method, or brace-delimited block of code.  Note that, by
<a href="https://google.github.io/styleguide/jsguide.html#features-array-literals">5.2 Array literals</a> and <a href="https://google.github.io/styleguide/jsguide.html#features-object-literals">5.3 Object literals</a>, any array or
object literal may optionally be treated as if it were a block-like construct.</p>

<p class="tip">Tip: Use <code>clang-format</code>. The JavaScript community has invested effort to make
sure clang-format <q>does the right thing</q> on JavaScript files. <code>clang-format</code> has
integration with several popular
editors.</p>

<h3 id="formatting-braces" style="left: -46px; position: relative;">4.1 Braces<a href="https://google.github.io/styleguide/jsguide.html#formatting-braces" alt="link to formatting-braces"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="formatting-braces-all" style="left: -46px; position: relative;">4.1.1 Braces are used for all control structures<a href="https://google.github.io/styleguide/jsguide.html#formatting-braces-all" alt="link to formatting-braces-all"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Braces are required for all control structures (i.e. <code>if</code>, <code>else</code>, <code>for</code>, <code>do</code>,
<code>while</code>, as well as any others), even if the body contains only a single
statement.  The first statement of a non-empty block must begin on its own line.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js badcode prettyprint prettyprinted" style=""><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">someVeryLongCondition</span><span class="pun">())</span><span class="pln">
  doSomething</span><span class="pun">();</span><span class="pln">

</span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">let</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> foo</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> bar</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">[</span><span class="pln">i</span><span class="pun">]);</span></pre>

<p class="exception"><strong>Exception</strong>: A simple if statement that can fit entirely on a single line with
no wrapping (and that doesn’t have an else) may be kept on a single line with no
braces when it improves readability.  This is the only case in which a control
structure may omit braces and newlines.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">shortCondition</span><span class="pun">())</span><span class="pln"> foo</span><span class="pun">();</span></pre>

<h4 id="formatting-nonempty-blocks" style="left: -46px; position: relative;">4.1.2 Nonempty blocks: K&amp;R style<a href="https://google.github.io/styleguide/jsguide.html#formatting-nonempty-blocks" alt="link to formatting-nonempty-blocks"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Braces follow the Kernighan and Ritchie style (<q><a href="http://www.codinghorror.com/blog/2012/07/new-programming-jargon.html">Egyptian brackets</a></q>) for
<em>nonempty</em> blocks and block-like constructs:</p>

<ul>
<li>No line break before the opening brace.</li>
<li>Line break after the opening brace.</li>
<li>Line break before the closing brace.</li>
<li>Line break after the closing brace <em>if</em> that brace terminates a statement or
the body of a function or class statement, or a class method. Specifically,
there is <em>no</em> line break after the brace if it is followed by <code>else</code>, <code>catch</code>,
<code>while</code>, or a comma, semicolon, or right-parenthesis.</li>
</ul>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="typ">InnerClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">

  </span><span class="com">/** @param {number} foo */</span><span class="pln">
  method</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">condition</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      </span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="com">// Note: this might fail.</span><span class="pln">
        something</span><span class="pun">();</span><span class="pln">
      </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">err</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        recover</span><span class="pun">();</span><span class="pln">
      </span><span class="pun">}</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="formatting-empty-blocks" style="left: -46px; position: relative;">4.1.3 Empty blocks: may be concise<a href="https://google.github.io/styleguide/jsguide.html#formatting-empty-blocks" alt="link to formatting-empty-blocks"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>An empty block or block-like construct <em>may</em> be closed immediately after it is
opened, with no characters, space, or line break in between (i.e. <code>{}</code>),
<strong>unless</strong> it is a part of a <em>multi-block statement</em> (one that directly contains
multiple blocks: <code>if</code>/<code>else</code> or <code>try</code>/<code>catch</code>/<code>finally</code>).</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">function</span><span class="pln"> doNothing</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">condition</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">otherCondition</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span></pre>

<h3 id="formatting-block-indentation" style="left: -46px; position: relative;">4.2 Block indentation: +2 spaces<a href="https://google.github.io/styleguide/jsguide.html#formatting-block-indentation" alt="link to formatting-block-indentation"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Each time a new block or block-like construct is opened, the indent increases by
two spaces. When the block ends, the indent returns to the previous indent
level. The indent level applies to both code and comments throughout the
block. (See the example in <a href="https://google.github.io/styleguide/jsguide.html#formatting-nonempty-blocks">4.1.2 Nonempty blocks: K&amp;R style</a>).</p>

<h4 id="formatting-array-literals" style="left: -46px; position: relative;">4.2.1 Array literals: optionally <q>block-like</q><a href="https://google.github.io/styleguide/jsguide.html#formatting-array-literals" alt="link to formatting-array-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Any array literal may optionally be formatted as if it were a “block-like
construct.” For example, the following are all valid (<strong>not</strong> an exhaustive
list):</p>

<pre class="language-js prettyprint columns prettyprinted" style=""><span class="kwd">const</span><span class="pln"> a </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
  </span><span class="lit">0</span><span class="pun">,</span><span class="pln">
  </span><span class="lit">1</span><span class="pun">,</span><span class="pln">
  </span><span class="lit">2</span><span class="pun">,</span><span class="pln">
</span><span class="pun">];</span><span class="pln">

</span><span class="kwd">const</span><span class="pln"> b </span><span class="pun">=</span><span class="pln">
    </span><span class="pun">[</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">];</span><span class="pln">
</span></pre>

<pre class="language-js prettyprint columns prettyprinted" style=""><span class="kwd">const</span><span class="pln"> c </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">];</span><span class="pln">

someMethod</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
  </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln">
</span><span class="pun">],</span><span class="pln"> bar</span><span class="pun">);</span></pre>

<p>Other combinations are allowed, particularly when emphasizing semantic groupings
between elements, but should not be used only to reduce the vertical size of
larger arrays.</p>

<h4 id="formatting-object-literals" style="left: -46px; position: relative;">4.2.2 Object literals: optionally <q>block-like</q><a href="https://google.github.io/styleguide/jsguide.html#formatting-object-literals" alt="link to formatting-object-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Any object literal may optionally be formatted as if it were a “block-like
construct.” The same examples apply as <a href="https://google.github.io/styleguide/jsguide.html#formatting-array-literals">4.2.1 Array literals: optionally block-like</a>. For
example, the following are all valid (<strong>not</strong> an exhaustive list):</p>

<pre class="language-js prettyprint columns prettyprinted" style=""><span class="kwd">const</span><span class="pln"> a </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  a</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln">
  b</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

</span><span class="kwd">const</span><span class="pln"> b </span><span class="pun">=</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">a</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1</span><span class="pun">};</span></pre>

<pre class="language-js prettyprint columns prettyprinted" style=""><span class="kwd">const</span><span class="pln"> c </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">a</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1</span><span class="pun">};</span><span class="pln">

someMethod</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  a</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln">
</span><span class="pun">},</span><span class="pln"> bar</span><span class="pun">);</span></pre>

<h4 id="formatting-class-literals" style="left: -46px; position: relative;">4.2.3 Class literals<a href="https://google.github.io/styleguide/jsguide.html#formatting-class-literals" alt="link to formatting-class-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Class literals (whether declarations or expressions) are indented as blocks. Do
not add semicolons after methods, or after the closing brace of a class
<em>declaration</em> (statements—such as assignments—that contain class <em>expressions</em>
are still terminated with a semicolon). Use the <code>extends</code> keyword, but not the
<code>@extends</code> JSDoc annotation unless the class extends a templatized type.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint columns prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">/** @type {number} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">x </span><span class="pun">=</span><span class="pln"> </span><span class="lit">42</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">

  </span><span class="com">/** @return {number} */</span><span class="pln">
  method</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">x</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="typ">Foo</span><span class="pun">.</span><span class="typ">Empty</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="pun">{};</span></pre>

<pre class="language-js prettyprint columns prettyprinted" style=""><span class="com">/** @extends {Foo&lt;string&gt;} */</span><span class="pln">
foo</span><span class="pun">.</span><span class="typ">Bar</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> extends </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @override */</span><span class="pln">
  method</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> super</span><span class="pun">.</span><span class="pln">method</span><span class="pun">()</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> </span><span class="lit">2</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

</span><span class="com">/** @interface */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Frobnicator</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @param {string} message */</span><span class="pln">
  frobnicate</span><span class="pun">(</span><span class="pln">message</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="formatting-function-expressions" style="left: -46px; position: relative;">4.2.4 Function expressions<a href="https://google.github.io/styleguide/jsguide.html#formatting-function-expressions" alt="link to formatting-function-expressions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>When declaring an anonymous function in the list of arguments for a function
call, the body of the function is indented two spaces more than the preceding
indentation depth.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">prefix</span><span class="pun">.</span><span class="pln">something</span><span class="pun">.</span><span class="pln">reallyLongFunctionName</span><span class="pun">(</span><span class="str">'whatever'</span><span class="pun">,</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a1</span><span class="pun">,</span><span class="pln"> a2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// Indent the function body +2 relative to indentation depth</span><span class="pln">
  </span><span class="com">// of the 'prefix' statement one line above.</span><span class="pln">
  </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">a1</span><span class="pun">.</span><span class="pln">equals</span><span class="pun">(</span><span class="pln">a2</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    someOtherLongFunctionName</span><span class="pun">(</span><span class="pln">a1</span><span class="pun">);</span><span class="pln">
  </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    andNowForSomethingCompletelyDifferent</span><span class="pun">(</span><span class="pln">a2</span><span class="pun">.</span><span class="pln">parrot</span><span class="pun">);</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">});</span><span class="pln">

some</span><span class="pun">.</span><span class="pln">reallyLongFunctionCall</span><span class="pun">(</span><span class="pln">arg1</span><span class="pun">,</span><span class="pln"> arg2</span><span class="pun">,</span><span class="pln"> arg3</span><span class="pun">)</span><span class="pln">
    </span><span class="pun">.</span><span class="pln">thatsWrapped</span><span class="pun">()</span><span class="pln">
    </span><span class="pun">.</span><span class="pln">then</span><span class="pun">((</span><span class="pln">result</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      </span><span class="com">// Indent the function body +2 relative to the indentation depth</span><span class="pln">
      </span><span class="com">// of the '.then()' call.</span><span class="pln">
      </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">result</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        result</span><span class="pun">.</span><span class="pln">use</span><span class="pun">();</span><span class="pln">
      </span><span class="pun">}</span><span class="pln">
    </span><span class="pun">});</span></pre>

<h4 id="formatting-switch-statements" style="left: -46px; position: relative;">4.2.5 Switch statements<a href="https://google.github.io/styleguide/jsguide.html#formatting-switch-statements" alt="link to formatting-switch-statements"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>As with any other block, the contents of a switch block are indented +2.</p>



<p>After a switch label, a newline appears, and the indentation level is increased
+2, exactly as if a block were being opened. An explicit block may be used if
required by lexical scoping. The following switch label returns to the previous
indentation level, as if a block had been closed.</p>

<p>A blank line is optional between a <code>break</code> and the following case.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">switch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">animal</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">case</span><span class="pln"> </span><span class="typ">Animal</span><span class="pun">.</span><span class="pln">BANDERSNATCH</span><span class="pun">:</span><span class="pln">
    handleBandersnatch</span><span class="pun">();</span><span class="pln">
    </span><span class="kwd">break</span><span class="pun">;</span><span class="pln">

  </span><span class="kwd">case</span><span class="pln"> </span><span class="typ">Animal</span><span class="pun">.</span><span class="pln">JABBERWOCK</span><span class="pun">:</span><span class="pln">
    handleJabberwock</span><span class="pun">();</span><span class="pln">
    </span><span class="kwd">break</span><span class="pun">;</span><span class="pln">

  </span><span class="kwd">default</span><span class="pun">:</span><span class="pln">
    </span><span class="kwd">throw</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Error</span><span class="pun">(</span><span class="str">'Unknown animal'</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span></pre>

<h3 id="formatting-statements" style="left: -46px; position: relative;">4.3 Statements<a href="https://google.github.io/styleguide/jsguide.html#formatting-statements" alt="link to formatting-statements"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="formatting-one-statement-perline" style="left: -46px; position: relative;">4.3.1 One statement per line<a href="https://google.github.io/styleguide/jsguide.html#formatting-one-statement-perline" alt="link to formatting-one-statement-perline"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Each statement is followed by a line-break.</p>

<h4 id="formatting-semicolons-are-required" style="left: -46px; position: relative;">4.3.2 Semicolons are required<a href="https://google.github.io/styleguide/jsguide.html#formatting-semicolons-are-required" alt="link to formatting-semicolons-are-required"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Every statement must be terminated with a semicolon. Relying on automatic
semicolon insertion is forbidden.</p>

<h3 id="formatting-column-limit" style="left: -46px; position: relative;">4.4 Column limit: 80<a href="https://google.github.io/styleguide/jsguide.html#formatting-column-limit" alt="link to formatting-column-limit"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>JavaScript code has a column limit of 80 characters. Except as noted below, any
line that would exceed this limit must be line-wrapped, as explained in
<a href="https://google.github.io/styleguide/jsguide.html#formatting-line-wrapping">4.5 Line-wrapping</a>.</p>

<p class="exceptions"><strong>Exceptions:</strong></p>

<ol>
<li><code>goog.module</code>, <code>goog.require</code> and <code>goog.requireType</code> statements (see
<a href="https://google.github.io/styleguide/jsguide.html#file-goog-module">3.3 goog.module statement</a> and <a href="https://google.github.io/styleguide/jsguide.html#file-goog-require">3.6 goog.require and goog.requireType statements</a>).</li>
<li>ES module <code>import</code> and <code>export from</code> statements (see
<a href="https://google.github.io/styleguide/jsguide.html#es-module-imports">3.4.1 Imports</a> and <a href="https://google.github.io/styleguide/jsguide.html#es-module-export-from">3.4.2.4 export from</a>).</li>
<li>Lines where obeying the column limit is not possible or would hinder
discoverability. Examples include:
<ul>
<li>A long URL which should be clickable in source.</li>
<li>A shell command intended to be copied-and-pasted.</li>
<li>A long string literal which may need to be copied or searched for wholly
(e.g., a long file path).</li>
</ul></li>
</ol>

<h3 id="formatting-line-wrapping" style="left: -46px; position: relative;">4.5 Line-wrapping<a href="https://google.github.io/styleguide/jsguide.html#formatting-line-wrapping" alt="link to formatting-line-wrapping"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p><strong>Terminology Note</strong>: <em>Line wrapping</em> is breaking a chunk of code into multiple
lines to obey column limit, where the chunk could otherwise legally fit in a
single line.</p>

<p>There is no comprehensive, deterministic formula showing <em>exactly</em> how to
line-wrap in every situation. Very often there are several valid ways to
line-wrap the same piece of code.</p>

<p class="note">Note: While the typical reason for line-wrapping is to avoid overflowing the
column limit, even code that would in fact fit within the column limit may be
line-wrapped at the author's discretion.</p>

<p class="tip">Tip: Extracting a method or local variable may solve the problem without the
need to line-wrap.</p>

<h4 id="formatting-where-to-break" style="left: -46px; position: relative;">4.5.1 Where to break<a href="https://google.github.io/styleguide/jsguide.html#formatting-where-to-break" alt="link to formatting-where-to-break"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The prime directive of line-wrapping is: prefer to break at a <strong>higher syntactic
level</strong>. </p>

<p class="preferred">Preferred:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">currentEstimate </span><span class="pun">=</span><span class="pln">
    calc</span><span class="pun">(</span><span class="pln">currentEstimate </span><span class="pun">+</span><span class="pln"> x </span><span class="pun">*</span><span class="pln"> currentEstimate</span><span class="pun">)</span><span class="pln"> </span><span class="pun">/</span><span class="pln">
        </span><span class="lit">2.0</span><span class="pun">;</span></pre>

<p class="discouraged">Discouraged:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pln">currentEstimate </span><span class="pun">=</span><span class="pln"> calc</span><span class="pun">(</span><span class="pln">currentEstimate </span><span class="pun">+</span><span class="pln"> x </span><span class="pun">*</span><span class="pln">
    currentEstimate</span><span class="pun">)</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> </span><span class="lit">2.0</span><span class="pun">;</span></pre>

<p>In the preceding example, the syntactic levels from highest to lowest are as
follows: assignment, division, function call, parameters, number constant.</p>

<p>Operators are wrapped as follows:</p>

<ol>
<li>When a line is broken at an operator the break comes after the symbol. (Note
that this is not the same practice used in Google style for Java.)
<ol>
<li>This does not apply to the <q>dot</q> (<code>.</code>), which is not actually an
operator.</li>
</ol></li>
<li>A method or constructor name stays attached to the open parenthesis (<code>(</code>)
that follows it.</li>
<li>A comma (<code>,</code>) stays attached to the token that precedes it.</li>
</ol>

<blockquote>
<p class="note">Note: The primary goal for line wrapping is to have clear code, not
necessarily code that fits in the smallest number of lines.</p>
</blockquote>

<h4 id="formatting-indent" style="left: -46px; position: relative;">4.5.2 Indent continuation lines at least +4 spaces<a href="https://google.github.io/styleguide/jsguide.html#formatting-indent" alt="link to formatting-indent"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>When line-wrapping, each line after the first (each <em>continuation line</em>) is
indented at least +4 from the original line, unless it falls under the rules of
block indentation.</p>

<p>When there are multiple continuation lines, indentation may be varied beyond +4
as appropriate.  In general, continuation lines at a deeper syntactic level are
indented by larger multiples of 4, and two lines use the same indentation level
if and only if they begin with syntactically parallel elements.</p>

<p><a href="https://google.github.io/styleguide/jsguide.html#formatting-horizontal-alignment">4.6.3 Horizontal alignment: discouraged</a> addresses the discouraged practice of
using a variable number of spaces to align certain tokens with previous lines.</p>

<h3 id="formatting-whitespace" style="left: -46px; position: relative;">4.6 Whitespace<a href="https://google.github.io/styleguide/jsguide.html#formatting-whitespace" alt="link to formatting-whitespace"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="formatting-vertical-whitespace" style="left: -46px; position: relative;">4.6.1 Vertical whitespace<a href="https://google.github.io/styleguide/jsguide.html#formatting-vertical-whitespace" alt="link to formatting-vertical-whitespace"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>A single blank line appears:</p>

<ol>
<li>Between consecutive methods in a class or object literal
<ol>
<li>Exception: A blank line between two consecutive properties definitions in
an object literal (with no other code between them) is optional. Such
blank lines are used as needed to create <em>logical groupings</em> of fields.</li>
</ol></li>
<li>Within method bodies, sparingly to create <em>logical groupings</em> of statements.
Blank lines at the start or end of a function body are not allowed.</li>
<li><em>Optionally</em> before the first or after the last method in a class or object
literal (neither encouraged nor discouraged).</li>
<li>As required by other sections of this document (e.g.
<a href="https://google.github.io/styleguide/jsguide.html#file-goog-require">3.6 goog.require and goog.requireType statements</a>).</li>
</ol>

<p><em>Multiple</em> consecutive blank lines are permitted, but never required (nor
encouraged).</p>

<h4 id="formatting-horizontal-whitespace" style="left: -46px; position: relative;">4.6.2 Horizontal whitespace<a href="https://google.github.io/styleguide/jsguide.html#formatting-horizontal-whitespace" alt="link to formatting-horizontal-whitespace"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Use of horizontal whitespace depends on location, and falls into three broad
categories: <em>leading</em> (at the start of a line), <em>trailing</em> (at the end of a
line), and <em>internal</em>.  Leading whitespace (i.e., indentation) is addressed
elsewhere.  Trailing whitespace is forbidden.</p>

<p>Beyond where required by the language or other style rules, and apart from
literals, comments, and JSDoc, a single internal ASCII space also appears in the
following places <strong>only</strong>.</p>

<ol>
<li>Separating any reserved word (such as <code>if</code>, <code>for</code>, or <code>catch</code>) except for
<code>function</code> and <code>super</code>, from an open parenthesis (<code>(</code>) that follows it on
that line.</li>
<li>Separating any reserved word (such as <code>else</code> or <code>catch</code>) from a closing
curly brace (<code>}</code>) that precedes it on that line.</li>
<li>Before any open curly brace (<code>{</code>), with two exceptions:
<ol>
<li>Before an object literal that is the first argument of a function or the
first element in an array literal (e.g. <code>foo({a: [{c: d}]})</code>).</li>
<li>In a template expansion, as it is forbidden by the language (e.g. valid:
<code>`ab${1 + 2}cd`</code>, invalid: <code class="badcode">`xy$ {3}z`</code>).</li>
</ol></li>
<li>On both sides of any binary or ternary operator.</li>
<li>After a comma (<code>,</code>) or semicolon (<code>;</code>). Note that spaces are <em>never</em> allowed
before these characters.</li>
<li>After the colon (<code>:</code>) in an object literal.</li>
<li>On both sides of the double slash (<code>//</code>) that begins an end-of-line comment.
Here, multiple spaces are allowed, but not required.</li>
<li>After an open-block comment character and on both sides of close characters
(e.g. for short-form type declarations, casts, and parameter name comments:
<code>this.foo = /** @type {number} */ (bar)</code>; or <code>function(/** string */ foo)
{</code>; or <code>baz(/* buzz= */ true)</code>).</li>
</ol>

<h4 id="formatting-horizontal-alignment" style="left: -46px; position: relative;">4.6.3 Horizontal alignment: discouraged<a href="https://google.github.io/styleguide/jsguide.html#formatting-horizontal-alignment" alt="link to formatting-horizontal-alignment"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p><strong>Terminology Note</strong>: <em>Horizontal alignment</em> is the practice of adding a
variable number of additional spaces in your code with the goal of making
certain tokens appear directly below certain other tokens on previous lines.</p>

<p>This practice is permitted, but it is <strong>generally discouraged</strong> by Google
Style. It is not even required to <em>maintain</em> horizontal alignment in places
where it was already used.</p>

<p>Here is an example without alignment, followed by one with alignment.  Both are
allowed, but the latter is discouraged:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pun">{</span><span class="pln">
  tiny</span><span class="pun">:</span><span class="pln"> </span><span class="lit">42</span><span class="pun">,</span><span class="pln"> </span><span class="com">// this is great</span><span class="pln">
  longer</span><span class="pun">:</span><span class="pln"> </span><span class="lit">435</span><span class="pun">,</span><span class="pln"> </span><span class="com">// this too</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

</span><span class="pun">{</span><span class="pln">
  tiny</span><span class="pun">:</span><span class="pln">   </span><span class="lit">42</span><span class="pun">,</span><span class="pln">  </span><span class="com">// permitted, but future edits</span><span class="pln">
  longer</span><span class="pun">:</span><span class="pln"> </span><span class="lit">435</span><span class="pun">,</span><span class="pln"> </span><span class="com">// may leave it unaligned</span><span class="pln">
</span><span class="pun">};</span></pre>

<p class="tip">Tip: Alignment can aid readability, but it creates problems for future
maintenance. Consider a future change that needs to touch just one line. This
change may leave the formerly-pleasing formatting mangled, and that is
allowed. More often it prompts the coder (perhaps you) to adjust whitespace on
nearby lines as well, possibly triggering a cascading series of
reformattings. That one-line change now has a <q>blast radius.</q> This can at worst
result in pointless busywork, but at best it still corrupts version history
information, slows down reviewers and exacerbates merge conflicts.</p>

<h4 id="formatting-function-arguments" style="left: -46px; position: relative;">4.6.4 Function arguments<a href="https://google.github.io/styleguide/jsguide.html#formatting-function-arguments" alt="link to formatting-function-arguments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Prefer to put all function arguments on the same line as the function name. If doing so would exceed the 80-column limit, the arguments must be line-wrapped in a readable way. To save space, you may wrap as close to 80 as possible, or put each argument on its own line to enhance readability. Indentation should be four spaces. Aligning to the parenthesis is allowed, but discouraged. Below are the most common patterns for argument wrapping:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">// Arguments start on a new line, indented four spaces. Preferred when the</span><span class="pln">
</span><span class="com">// arguments don't fit on the same line with the function name (or the keyword</span><span class="pln">
</span><span class="com">// "function") but fit entirely on the second line. Works with very long</span><span class="pln">
</span><span class="com">// function names, survives renaming without reindenting, low on space.</span><span class="pln">
doSomething</span><span class="pun">(</span><span class="pln">
    descriptiveArgumentOne</span><span class="pun">,</span><span class="pln"> descriptiveArgumentTwo</span><span class="pun">,</span><span class="pln"> descriptiveArgumentThree</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">// If the argument list is longer, wrap at 80. Uses less vertical space,</span><span class="pln">
</span><span class="com">// but violates the rectangle rule and is thus not recommended.</span><span class="pln">
doSomething</span><span class="pun">(</span><span class="pln">veryDescriptiveArgumentNumberOne</span><span class="pun">,</span><span class="pln"> veryDescriptiveArgumentTwo</span><span class="pun">,</span><span class="pln">
    tableModelEventHandlerProxy</span><span class="pun">,</span><span class="pln"> artichokeDescriptorAdapterIterator</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">// Four-space, one argument per line.  Works with long function names,</span><span class="pln">
</span><span class="com">// survives renaming, and emphasizes each argument.</span><span class="pln">
doSomething</span><span class="pun">(</span><span class="pln">
    veryDescriptiveArgumentNumberOne</span><span class="pun">,</span><span class="pln">
    veryDescriptiveArgumentTwo</span><span class="pun">,</span><span class="pln">
    tableModelEventHandlerProxy</span><span class="pun">,</span><span class="pln">
    artichokeDescriptorAdapterIterator</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span></pre>

<h3 id="formatting-grouping-parentheses" style="left: -46px; position: relative;">4.7 Grouping parentheses: recommended<a href="https://google.github.io/styleguide/jsguide.html#formatting-grouping-parentheses" alt="link to formatting-grouping-parentheses"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Optional grouping parentheses are omitted only when the author and reviewer
agree that there is no reasonable chance that the code will be misinterpreted
without them, nor would they have made the code easier to read. It is <em>not</em>
reasonable to assume that every reader has the entire operator precedence table
memorized.</p>

<p>Do not use unnecessary parentheses around the entire expression following
<code>delete</code>, <code>typeof</code>, <code>void</code>, <code>return</code>, <code>throw</code>, <code>case</code>, <code>in</code>, <code>of</code>, or <code>yield</code>.</p>

<p>Parentheses are required for type casts: <code>/** @type {!Foo} */ (foo)</code>.</p>

<h3 id="formatting-comments" style="left: -46px; position: relative;">4.8 Comments<a href="https://google.github.io/styleguide/jsguide.html#formatting-comments" alt="link to formatting-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>This section addresses <em>implementation comments</em>. JSDoc is addressed separately
in <a href="https://google.github.io/styleguide/jsguide.html#jsdoc">7 JSDoc</a>.</p>

<h4 id="formatting-block-comment-style" style="left: -46px; position: relative;">4.8.1 Block comment style<a href="https://google.github.io/styleguide/jsguide.html#formatting-block-comment-style" alt="link to formatting-block-comment-style"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Block comments are indented at the same level as the surrounding code. They may
be in <code>/* … */</code> or <code>//</code>-style. For multi-line <code>/* … */</code> comments, subsequent
lines must start with * aligned with the <code>*</code> on the previous line, to make
comments obvious with no extra context.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/*
 * This is
 * okay.
 */</span><span class="pln">

</span><span class="com">// And so</span><span class="pln">
</span><span class="com">// is this.</span><span class="pln">

</span><span class="com">/* This is fine, too. */</span></pre>

<p>Comments are not enclosed in boxes drawn with asterisks or other characters.</p>

<p>Do not use JSDoc (<code>/** … */</code>) for implementation comments.</p>

<h4 id="formatting-param-name-comments" style="left: -46px; position: relative;">4.8.2 Parameter Name Comments<a href="https://google.github.io/styleguide/jsguide.html#formatting-param-name-comments" alt="link to formatting-param-name-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>“Parameter name” comments should be used whenever the value and method name do
not sufficiently convey the meaning, and refactoring the method to be clearer is
infeasible .
Their preferred format is before the value with <q>=</q>:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">someFunction</span><span class="pun">(</span><span class="pln">obviousParam</span><span class="pun">,</span><span class="pln"> </span><span class="com">/* shouldRender= */</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">,</span><span class="pln"> </span><span class="com">/* name= */</span><span class="pln"> </span><span class="str">'hello'</span><span class="pun">);</span></pre>

<p>For consistency with surrounding code you may put them after the value without
<q>=</q>:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">someFunction</span><span class="pun">(</span><span class="pln">obviousParam</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">true</span><span class="pln"> </span><span class="com">/* shouldRender */</span><span class="pun">,</span><span class="pln"> </span><span class="str">'hello'</span><span class="pln"> </span><span class="com">/* name */</span><span class="pun">);</span></pre>

<h2 id="language-features" style="left: -46px; position: relative;">5 Language features<a href="https://google.github.io/styleguide/jsguide.html#language-features" alt="link to language-features"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<p>JavaScript includes many dubious (and even dangerous) features.  This section
delineates which features may or may not be used, and any additional constraints
on their use.</p>

<h3 id="features-local-variable-declarations" style="left: -46px; position: relative;">5.1 Local variable declarations<a href="https://google.github.io/styleguide/jsguide.html#features-local-variable-declarations" alt="link to features-local-variable-declarations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-use-const-and-let" style="left: -46px; position: relative;">5.1.1 Use <code>const</code> and <code>let</code><a href="https://google.github.io/styleguide/jsguide.html#features-use-const-and-let" alt="link to features-use-const-and-let"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Declare all local variables with either <code>const</code> or <code>let</code>. Use const by default,
unless a variable needs to be reassigned. The <code class="badcode">var</code>
keyword must not be used.</p>

<h4 id="features-one-variable-per-declaration" style="left: -46px; position: relative;">5.1.2 One variable per declaration<a href="https://google.github.io/styleguide/jsguide.html#features-one-variable-per-declaration" alt="link to features-one-variable-per-declaration"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Every local variable declaration declares only one variable: declarations such
as <code class="badcode">let a = 1, b = 2;</code> are not used.</p>

<h4 id="features-declared-when-needed" style="left: -46px; position: relative;">5.1.3 Declared when needed, initialized as soon as possible<a href="https://google.github.io/styleguide/jsguide.html#features-declared-when-needed" alt="link to features-declared-when-needed"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Local variables are <strong>not</strong> habitually declared at the start of their containing
block or block-like construct. Instead, local variables are declared close to
the point they are first used (within reason), to minimize their scope.</p>

<h4 id="features-declare-types-as-needed" style="left: -46px; position: relative;">5.1.4 Declare types as needed<a href="https://google.github.io/styleguide/jsguide.html#features-declare-types-as-needed" alt="link to features-declare-types-as-needed"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>JSDoc type annotations may be added either on the line above the declaration, or
else inline before the variable name if no other JSDoc is present.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Array&lt;number&gt; */</span><span class="pln"> data </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[];</span><span class="pln">

</span><span class="com">/**
 * Some description.
 * @type {!Array&lt;number&gt;}
 */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> data </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[];</span></pre>

<p>Mixing inline and JSDoc styles is not allowed: the compiler will only process
the first JsDoc and the inline annotations will be lost.</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/** Some description. */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Array&lt;number&gt; */</span><span class="pln"> data </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[];</span></pre>

<p class="tip">Tip: There are many cases where the compiler can infer a templatized type but
not its parameters.  This is particularly the case when the initializing literal
or constructor call does not include any values of the template parameter type
(e.g., empty arrays, objects, <code>Map</code>s, or <code>Set</code>s), or if the variable is modified
in a closure.  Local variable type annotations are particularly helpful in these
cases since otherwise the compiler will infer the template parameter as unknown.</p>

<h3 id="features-array-literals" style="left: -46px; position: relative;">5.2 Array literals<a href="https://google.github.io/styleguide/jsguide.html#features-array-literals" alt="link to features-array-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-arrays-trailing-comma" style="left: -46px; position: relative;">5.2.1 Use trailing commas<a href="https://google.github.io/styleguide/jsguide.html#features-arrays-trailing-comma" alt="link to features-arrays-trailing-comma"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>



<p>Include a trailing comma whenever there is a line break between the final
element and the closing bracket.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> values </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
  </span><span class="str">'first value'</span><span class="pun">,</span><span class="pln">
  </span><span class="str">'second value'</span><span class="pun">,</span><span class="pln">
</span><span class="pun">];</span></pre>

<h4 id="features-arrays-ctor" style="left: -46px; position: relative;">5.2.2 Do not use the variadic <code>Array</code> constructor<a href="https://google.github.io/styleguide/jsguide.html#features-arrays-ctor" alt="link to features-arrays-ctor"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The constructor is error-prone if arguments are added or removed. Use a literal
instead.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">const</span><span class="pln"> a1 </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Array</span><span class="pun">(</span><span class="pln">x1</span><span class="pun">,</span><span class="pln"> x2</span><span class="pun">,</span><span class="pln"> x3</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> a2 </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Array</span><span class="pun">(</span><span class="pln">x1</span><span class="pun">,</span><span class="pln"> x2</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> a3 </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Array</span><span class="pun">(</span><span class="pln">x1</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> a4 </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Array</span><span class="pun">();</span></pre>

<p>This works as expected except for the third case: if <code>x1</code> is a whole number then
<code>a3</code> is an array of size <code>x1</code> where all elements are <code>undefined</code>. If <code>x1</code> is any
other number, then an exception will be thrown, and if it is anything else then
it will be a single-element array.</p>

<p>Instead, write</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> a1 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">x1</span><span class="pun">,</span><span class="pln"> x2</span><span class="pun">,</span><span class="pln"> x3</span><span class="pun">];</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> a2 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">x1</span><span class="pun">,</span><span class="pln"> x2</span><span class="pun">];</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> a3 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">x1</span><span class="pun">];</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> a4 </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[];</span></pre>

<p>Explicitly allocating an array of a given length using <code>new Array(length)</code> is
allowed when appropriate.</p>

<h4 id="features-arrays-non-numeric-properties" style="left: -46px; position: relative;">5.2.3 Non-numeric properties<a href="https://google.github.io/styleguide/jsguide.html#features-arrays-non-numeric-properties" alt="link to features-arrays-non-numeric-properties"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not define or use non-numeric properties on an array (other than
<code>length</code>). Use a <code>Map</code> (or <code>Object</code>) instead.</p>

<h4 id="features-arrays-destructuring" style="left: -46px; position: relative;">5.2.4 Destructuring<a href="https://google.github.io/styleguide/jsguide.html#features-arrays-destructuring" alt="link to features-arrays-destructuring"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Array literals may be used on the left-hand side of an assignment to perform
destructuring (such as when unpacking multiple values from a single array or
iterable).  A final <q>rest</q> element may be included (with no space between the
<code>...</code> and the variable name). Elements should be omitted if they are unused.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="pun">[</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">,</span><span class="pln"> c</span><span class="pun">,</span><span class="pln"> </span><span class="pun">...</span><span class="pln">rest</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> generateResults</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">let</span><span class="pln"> </span><span class="pun">[,</span><span class="pln"> b</span><span class="pun">,,</span><span class="pln"> d</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> someArray</span><span class="pun">;</span></pre>

<p>Destructuring may also be used for function parameters (note that a parameter
name is required but ignored). Always specify <code>[]</code> as the default value if a
destructured array parameter is optional, and provide default values on the left
hand side:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @param {!Array&lt;number&gt;=} param1 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> optionalDestructuring</span><span class="pun">([</span><span class="pln">a </span><span class="pun">=</span><span class="pln"> </span><span class="lit">4</span><span class="pun">,</span><span class="pln"> b </span><span class="pun">=</span><span class="pln"> </span><span class="lit">2</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[])</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">…</span><span class="pln"> </span><span class="pun">};</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">function</span><span class="pln"> badDestructuring</span><span class="pun">([</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="lit">4</span><span class="pun">,</span><span class="pln"> </span><span class="lit">2</span><span class="pun">])</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">…</span><span class="pln"> </span><span class="pun">};</span></pre>

<p class="tip">Tip: For (un)packing multiple values into a function’s parameter or return,
prefer object destructuring to array destructuring when possible, as it allows
naming the individual elements and specifying a different type for each.</p>

<h4 id="features-arrays-spread-operator" style="left: -46px; position: relative;">5.2.5 Spread operator<a href="https://google.github.io/styleguide/jsguide.html#features-arrays-spread-operator" alt="link to features-arrays-spread-operator"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Array literals may include the spread operator (<code>...</code>) to flatten elements out
of one or more other iterables.  The spread operator should be used instead of
more awkward constructs with <code>Array.prototype</code>.  There is no space after the
<code>...</code>.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pun">[...</span><span class="pln">foo</span><span class="pun">]</span><span class="pln">   </span><span class="com">// preferred over Array.prototype.slice.call(foo)</span><span class="pln">
</span><span class="pun">[...</span><span class="pln">foo</span><span class="pun">,</span><span class="pln"> </span><span class="pun">...</span><span class="pln">bar</span><span class="pun">]</span><span class="pln">   </span><span class="com">// preferred over foo.concat(bar)</span></pre>

<h3 id="features-object-literals" style="left: -46px; position: relative;">5.3 Object literals<a href="https://google.github.io/styleguide/jsguide.html#features-object-literals" alt="link to features-object-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-objects-use-trailing-comma" style="left: -46px; position: relative;">5.3.1 Use trailing commas<a href="https://google.github.io/styleguide/jsguide.html#features-objects-use-trailing-comma" alt="link to features-objects-use-trailing-comma"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Include a trailing comma whenever there is a line break between the final
property and the closing brace.</p>

<h4 id="features-objects-ctor" style="left: -46px; position: relative;">5.3.2 Do not use the <code>Object</code> constructor<a href="https://google.github.io/styleguide/jsguide.html#features-objects-ctor" alt="link to features-objects-ctor"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>While <code>Object</code> does not have the same problems as <code>Array</code>, it is still
disallowed for consistency. Use an object literal (<code>{}</code> or <code>{a: 0, b: 1, c: 2}</code>)
instead.</p>

<h4 id="features-objects-mixing-keys" style="left: -46px; position: relative;">5.3.3 Do not mix quoted and unquoted keys<a href="https://google.github.io/styleguide/jsguide.html#features-objects-mixing-keys" alt="link to features-objects-mixing-keys"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Object literals may represent either <em>structs</em> (with unquoted keys and/or
symbols) or <em>dicts</em> (with quoted and/or computed keys). Do not mix these key
types in a single object literal.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pun">{</span><span class="pln">
  width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">42</span><span class="pun">,</span><span class="pln"> </span><span class="com">// struct-style unquoted key</span><span class="pln">
  </span><span class="str">'maxWidth'</span><span class="pun">:</span><span class="pln"> </span><span class="lit">43</span><span class="pun">,</span><span class="pln"> </span><span class="com">// dict-style quoted key</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>This also extends to passing the property name to functions, like
<code>hasOwnProperty</code>. In particular, doing so will break in compiled code because
the compiler cannot rename/obfuscate the string literal.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/** @type {{width: number, maxWidth: (number|undefined)}} */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> o </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">42</span><span class="pun">};</span><span class="pln">
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">o</span><span class="pun">.</span><span class="pln">hasOwnProperty</span><span class="pun">(</span><span class="str">'maxWidth'</span><span class="pun">))</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="pun">...</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>This is best implemented as:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @type {{width: number, maxWidth: (number|undefined)}} */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> o </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">42</span><span class="pun">};</span><span class="pln">
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">o</span><span class="pun">.</span><span class="pln">maxWidth </span><span class="pun">!=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="pun">...</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="features-objects-computed-property-names" style="left: -46px; position: relative;">5.3.4 Computed property names<a href="https://google.github.io/styleguide/jsguide.html#features-objects-computed-property-names" alt="link to features-objects-computed-property-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Computed property names (e.g., <code>{['key' + foo()]: 42}</code>) are allowed, and are
considered dict-style (quoted) keys (i.e., must not be mixed with non-quoted
keys) unless the computed property is a
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol">symbol</a>
(e.g., <code>[Symbol.iterator]</code>). Enum values may also be used for computed keys, but
should not be mixed with non-enum keys in the same literal.</p>

<h4 id="features-objects-method-shorthand" style="left: -46px; position: relative;">5.3.5 Method shorthand<a href="https://google.github.io/styleguide/jsguide.html#features-objects-method-shorthand" alt="link to features-objects-method-shorthand"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Methods can be defined on object literals using the method shorthand (<code>{method()
{… }}</code>) in place of a colon immediately followed by a <code>function</code> or arrow
function literal.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">return</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  stuff</span><span class="pun">:</span><span class="pln"> </span><span class="str">'candy'</span><span class="pun">,</span><span class="pln">
  method</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">stuff</span><span class="pun">;</span><span class="pln">  </span><span class="com">// Returns 'candy'</span><span class="pln">
  </span><span class="pun">},</span><span class="pln">
</span><span class="pun">};</span></pre>

<p>Note that <code>this</code> in a method shorthand or <code>function</code> refers to the object
literal itself whereas <code>this</code> in an arrow function refers to the scope outside
the object literal.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  getObjectLiteral</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">stuff </span><span class="pun">=</span><span class="pln"> </span><span class="str">'fruit'</span><span class="pun">;</span><span class="pln">
    </span><span class="kwd">return</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      stuff</span><span class="pun">:</span><span class="pln"> </span><span class="str">'candy'</span><span class="pun">,</span><span class="pln">
      method</span><span class="pun">:</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">stuff</span><span class="pun">,</span><span class="pln">  </span><span class="com">// Returns 'fruit'</span><span class="pln">
    </span><span class="pun">};</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="features-objects-shorthand-properties" style="left: -46px; position: relative;">5.3.6 Shorthand properties<a href="https://google.github.io/styleguide/jsguide.html#features-objects-shorthand-properties" alt="link to features-objects-shorthand-properties"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Shorthand properties are allowed on object literals.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> foo </span><span class="pun">=</span><span class="pln"> </span><span class="lit">1</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> bar </span><span class="pun">=</span><span class="pln"> </span><span class="lit">2</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> obj </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  foo</span><span class="pun">,</span><span class="pln">
  bar</span><span class="pun">,</span><span class="pln">
  method</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">foo </span><span class="pun">+</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">bar</span><span class="pun">;</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
</span><span class="pun">};</span><span class="pln">
assertEquals</span><span class="pun">(</span><span class="lit">3</span><span class="pun">,</span><span class="pln"> obj</span><span class="pun">.</span><span class="pln">method</span><span class="pun">());</span></pre>

<h4 id="features-objects-destructuring" style="left: -46px; position: relative;">5.3.7 Destructuring<a href="https://google.github.io/styleguide/jsguide.html#features-objects-destructuring" alt="link to features-objects-destructuring"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Object destructuring patterns may be used on the left-hand side of an assignment
to perform destructuring and unpack multiple values from a single object.</p>

<p>Destructured objects may also be used as function parameters, but should be kept
as simple as possible: a single level of unquoted shorthand properties. Deeper
levels of nesting and computed properties may not be used in parameter
destructuring.  Specify any default values in the left-hand-side of the
destructured parameter (<code>{str = 'some default'} = {}</code>, rather than <code class="badcode">{str} = {str: 'some default'}</code>), and if a destructured
object is itself optional, it must default to <code>{}</code>.  The JSDoc for the
destructured parameter may be given any name (the name is unused but is required
by the compiler).</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @param {string} ordinary
 * @param {{num: (number|undefined), str: (string|undefined)}=} param1
 *     num: The number of times to do something.
 *     str: A string to do stuff to.
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> destructured</span><span class="pun">(</span><span class="pln">ordinary</span><span class="pun">,</span><span class="pln"> </span><span class="pun">{</span><span class="pln">num</span><span class="pun">,</span><span class="pln"> str </span><span class="pun">=</span><span class="pln"> </span><span class="str">'some default'</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{})</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/** @param {{x: {num: (number|undefined), str: (string|undefined)}}} param1 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> nestedTooDeeply</span><span class="pun">({</span><span class="pln">x</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln">num</span><span class="pun">,</span><span class="pln"> str</span><span class="pun">}})</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
</span><span class="com">/** @param {{num: (number|undefined), str: (string|undefined)}=} param1 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> nonShorthandProperty</span><span class="pun">({</span><span class="pln">num</span><span class="pun">:</span><span class="pln"> a</span><span class="pun">,</span><span class="pln"> str</span><span class="pun">:</span><span class="pln"> b</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{})</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
</span><span class="com">/** @param {{a: number, b: number}} param1 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> computedKey</span><span class="pun">({</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">,</span><span class="pln"> </span><span class="pun">[</span><span class="pln">a </span><span class="pun">+</span><span class="pln"> b</span><span class="pun">]:</span><span class="pln"> c</span><span class="pun">})</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
</span><span class="com">/** @param {{a: number, b: string}=} param1 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> nontrivialDefault</span><span class="pun">({</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">a</span><span class="pun">:</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">:</span><span class="pln"> </span><span class="lit">4</span><span class="pun">})</span><span class="pln"> </span><span class="pun">{};</span></pre>

<p>Destructuring may also be used for <code>goog.require</code> statements, and in this case
must not be wrapped: the entire statement occupies one line, regardless of how
long it is (see <a href="https://google.github.io/styleguide/jsguide.html#file-goog-require">3.6 goog.require and goog.requireType statements</a>).</p>

<h4 id="features-objects-enums" style="left: -46px; position: relative;">5.3.8 Enums<a href="https://google.github.io/styleguide/jsguide.html#features-objects-enums" alt="link to features-objects-enums"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Enumerations are defined by adding the <code>@enum</code> annotation to an object literal.
Additional properties may not be added to an enum after it is defined.  Enums
must be constant, and all enum values must be deeply immutable.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Supported temperature scales.
 * @enum {string}
 */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">TemperatureScale</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  CELSIUS</span><span class="pun">:</span><span class="pln"> </span><span class="str">'celsius'</span><span class="pun">,</span><span class="pln">
  FAHRENHEIT</span><span class="pun">:</span><span class="pln"> </span><span class="str">'fahrenheit'</span><span class="pun">,</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

</span><span class="com">/**
 * An enum with two options.
 * @enum {number}
 */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">Option</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** The option used shall have been the first. */</span><span class="pln">
  FIRST_OPTION</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1</span><span class="pun">,</span><span class="pln">
  </span><span class="com">/** The second among two options. */</span><span class="pln">
  SECOND_OPTION</span><span class="pun">:</span><span class="pln"> </span><span class="lit">2</span><span class="pun">,</span><span class="pln">
</span><span class="pun">};</span></pre>

<h3 id="features-classes" style="left: -46px; position: relative;">5.4 Classes<a href="https://google.github.io/styleguide/jsguide.html#features-classes" alt="link to features-classes"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-classes-constructors" style="left: -46px; position: relative;">5.4.1 Constructors<a href="https://google.github.io/styleguide/jsguide.html#features-classes-constructors" alt="link to features-classes-constructors"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Constructors are optional. Subclass constructors must call <code>super()</code> before
setting any fields or otherwise accessing <code>this</code>. Interfaces should declare
non-method properties in the constructor.</p>

<h4 id="features-classes-fields" style="left: -46px; position: relative;">5.4.2 Fields<a href="https://google.github.io/styleguide/jsguide.html#features-classes-fields" alt="link to features-classes-fields"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Set all of a concrete object’s fields (i.e. all properties other than methods)
in the constructor. Annotate fields that are never reassigned with <code>@const</code>
(these need not be deeply immutable). Annotate non-public fields with the proper
visibility annotation (<code>@private</code>, <code>@protected</code>, <code>@package</code>), and end all
<code>@private</code> fields' names with an underscore. Fields are never set on a concrete
class' <code>prototype</code>.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">/** @private @const {!Bar} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">bar_ </span><span class="pun">=</span><span class="pln"> computeBar</span><span class="pun">();</span><span class="pln">

    </span><span class="com">/** @protected @const {!Baz} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">baz </span><span class="pun">=</span><span class="pln"> computeBaz</span><span class="pun">();</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<p class="tip">Tip: Properties should never be added to or removed from an instance after the
constructor is finished, since it significantly hinders VMs’ ability to
optimize.  If necessary, fields that are initialized later should be explicitly
set to <code>undefined</code> in the constructor to prevent later shape changes. Adding
<code>@struct</code> to an object will check that undeclared properties are not
added/accessed.  Classes have this added by default.</p>

<h4 id="features-classes-computed-properties" style="left: -46px; position: relative;">5.4.3 Computed properties<a href="https://google.github.io/styleguide/jsguide.html#features-classes-computed-properties" alt="link to features-classes-computed-properties"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>



<p>Computed properties may only be used in classes when the property is a
symbol. Dict-style properties (that is, quoted or computed non-symbol keys, as
defined in <a href="https://google.github.io/styleguide/jsguide.html#features-objects-mixing-keys">5.3.3 Do not mix quoted and unquoted keys</a>) are not allowed.  A
<code>[Symbol.iterator]</code> method should be defined for any classes that are logically
iterable.  Beyond this, <code>Symbol</code> should be used sparingly.</p>

<p class="tip">Tip: be careful of using any other built-in symbols (e.g., <code>Symbol.isConcatSpreadable</code>) as they are not polyfilled by the compiler and will therefore not work in older browsers.</p>

<h4 id="features-classes-static-methods" style="left: -46px; position: relative;">5.4.4 Static methods<a href="https://google.github.io/styleguide/jsguide.html#features-classes-static-methods" alt="link to features-classes-static-methods"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>



<p>Where it does not interfere with readability, prefer module-local functions over
private static methods.</p>

<p>Static methods should only be called on the base class itself. Static methods
should not be called on variables containing a dynamic instance that may be
either the constructor or a subclass constructor (and must be defined with
<code>@nocollapse</code> if this is done), and must not be called directly on a subclass
that doesn’t define the method itself.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="typ">Base</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">/** @nocollapse */</span><span class="pln"> </span><span class="kwd">static</span><span class="pln"> foo</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Sub</span><span class="pln"> extends </span><span class="typ">Base</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> callFoo</span><span class="pun">(</span><span class="pln">cls</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> cls</span><span class="pun">.</span><span class="pln">foo</span><span class="pun">();</span><span class="pln"> </span><span class="pun">}</span><span class="pln">  </span><span class="com">// discouraged: don't call static methods dynamically</span><span class="pln">
</span><span class="typ">Sub</span><span class="pun">.</span><span class="pln">foo</span><span class="pun">();</span><span class="pln">  </span><span class="com">// Disallowed: don't call static methods on subclasses that don't define it themselves</span></pre>

<h4 id="features-classes-old-style" style="left: -46px; position: relative;">5.4.5 Old-style class declarations<a href="https://google.github.io/styleguide/jsguide.html#features-classes-old-style" alt="link to features-classes-old-style"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>While ES6 classes are preferred, there are cases where ES6 classes may not be
feasible.  For example:</p>

<ol>
<li><p>If there exist or will exist subclasses, including frameworks that create
subclasses, that cannot be immediately changed to use ES6 class syntax. If
such a class were to use ES6 syntax, all downstream subclasses not using ES6
class syntax would need to be modified.</p></li>
<li><p>Frameworks that require a known <code>this</code> value before calling the superclass
constructor, since constructors with ES6 super classes do not have
access to the instance <code>this</code> value until the call to <code>super</code> returns.</p></li>
</ol>

<p>In all other ways the style guide still applies to this code: <code>let</code>, <code>const</code>,
default parameters, rest, and arrow functions should all be used when
appropriate.</p>

<p><code>goog.defineClass</code> allows for a class-like definition similar to ES6 class
syntax:</p>

<pre class="language-javascript">let C = goog.defineClass(S, {
  /**
   * @param {string} value
   */
  constructor(value) {
    S.call(this, 2);
    /** @const */
    this.prop = value;
  },

  /**
   * @param {string} param
   * @return {number}
   */
  method(param) {
    return 0;
  },
});
</pre>

<p>Alternatively, while <code>goog.defineClass</code> should be preferred for all new code,
more traditional syntax is also allowed.</p>

<pre class="language-javascript">/**
  * @constructor @extends {S}
  * @param {string} value
  */
function C(value) {
  S.call(this, 2);
  /** @const */
  this.prop = value;
}
goog.inherits(C, S);

/**
 * @param {string} param
 * @return {number}
 */
C.prototype.method = function(param) {
  return 0;
};
</pre>

<p>Per-instance properties should be defined in the constructor after the call to the super class constructor, if there is a super class.  Methods should be defined on the prototype of the constructor.</p>

<p>Defining constructor prototype hierarchies correctly is harder than it first appears!  For that reason, it is best to use <code>goog.inherits</code> from <a href="http://code.google.com/closure/library/">the Closure Library </a>.</p>

<h4 id="features-classes-prototypes" style="left: -46px; position: relative;">5.4.6 Do not manipulate <code>prototype</code>s directly<a href="https://google.github.io/styleguide/jsguide.html#features-classes-prototypes" alt="link to features-classes-prototypes"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The <code>class</code> keyword allows clearer and more readable class definitions than
defining <code>prototype</code> properties. Ordinary implementation code has no business
manipulating these objects, though they are still useful for defining classes as
defined in <a href="https://google.github.io/styleguide/jsguide.html#features-classes-old-style">5.4.5 Old-style class declarations</a>. Mixins and modifying the
prototypes of builtin objects are explicitly forbidden.</p>

<p class="exception"><strong>Exception</strong>: Framework code (such as Polymer, or Angular) may need to use <code>prototype</code>s, and should not
resort to even-worse workarounds to avoid doing so.</p>

<h4 id="features-classes-getters-and-setters" style="left: -46px; position: relative;">5.4.7 Getters and Setters<a href="https://google.github.io/styleguide/jsguide.html#features-classes-getters-and-setters" alt="link to features-classes-getters-and-setters"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get">JavaScript getter and setter properties</a>.  They are potentially
surprising and difficult to reason about, and have limited support in the
compiler.  Provide ordinary methods instead.</p>

<p class="exception"><strong>Exception</strong>: there are situations where defining a getter or setter is
unavoidable (e.g. data binding frameworks such as Angular and Polymer, or for
compatibility with external APIs that cannot be adjusted).  In these cases only,
getters and setters may be used <em>with caution</em>, provided they are defined with
the <code>get</code> and <code>set</code> shorthand method keywords or <code>Object.defineProperties</code> (not
<code>Object.defineProperty</code>, which interferes with property renaming).  Getters
<strong>must not</strong> change observable state.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">get</span><span class="pln"> next</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">nextId</span><span class="pun">++;</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="features-classes-overriding-tostring" style="left: -46px; position: relative;">5.4.8 Overriding toString<a href="https://google.github.io/styleguide/jsguide.html#features-classes-overriding-tostring" alt="link to features-classes-overriding-tostring"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The <code>toString</code> method may be overridden, but must always succeed and never have
visible side effects.</p>

<p class="tip">Tip: Beware, in particular, of calling other methods from toString, since
exceptional conditions could lead to infinite loops.</p>

<h4 id="features-classes-interfaces" style="left: -46px; position: relative;">5.4.9 Interfaces<a href="https://google.github.io/styleguide/jsguide.html#features-classes-interfaces" alt="link to features-classes-interfaces"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Interfaces may be declared with <code>@interface</code> or <code>@record</code>. Interfaces declared
with <code>@record</code> can be explicitly (i.e. via <code>@implements</code>) or implicitly
implemented by a class or object literal.</p>

<p>All non-static method bodies on an interface must be empty blocks. Fields must
be declared as uninitialized members in the class constructor.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Something that can frobnicate.
 * @record
 */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Frobnicator</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">/** @type {number} The number of attempts before giving up. */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">attempts</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">

  </span><span class="com">/**
   * Performs the frobnication according to the given strategy.
   * @param {!FrobnicationStrategy} strategy
   */</span><span class="pln">
  frobnicate</span><span class="pun">(</span><span class="pln">strategy</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span></pre>

<h4 id="features-classes-abstract-classes" style="left: -46px; position: relative;">5.4.10 Abstract Classes<a href="https://google.github.io/styleguide/jsguide.html#features-classes-abstract-classes" alt="link to features-classes-abstract-classes"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Use abstract classes when appropriate. Abstract classes and methods must be
annotated with <code>@abstract</code>. Do not use <code>goog.abstractMethod</code>. See <a href="https://github.com/google/closure-compiler/wiki/@abstract-classes-and-methods">abstract
classes and methods</a>.</p>

<h3 id="features-functions" style="left: -46px; position: relative;">5.5 Functions<a href="https://google.github.io/styleguide/jsguide.html#features-functions" alt="link to features-functions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-functions-top-level-functions" style="left: -46px; position: relative;">5.5.1 Top-level functions<a href="https://google.github.io/styleguide/jsguide.html#features-functions-top-level-functions" alt="link to features-functions-top-level-functions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Top-level functions may be defined directly on the <code>exports</code> object, or else
declared locally and optionally exported. See <a href="https://google.github.io/styleguide/jsguide.html#file-goog-module-exports">3.3.3 goog.module Exports</a>
for more on exports.</p>

<p class="examples">Examples:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @param {string} str */</span><span class="pln">
exports</span><span class="pun">.</span><span class="pln">processString </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">str</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// Process the string.</span><span class="pln">
</span><span class="pun">};</span></pre>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @param {string} str */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> processString </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">str</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// Process the string.</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

exports </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">processString</span><span class="pun">};</span></pre>

<h4 id="features-functions-nested-functions" style="left: -46px; position: relative;">5.5.2 Nested functions and closures<a href="https://google.github.io/styleguide/jsguide.html#features-functions-nested-functions" alt="link to features-functions-nested-functions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Functions may contain nested function definitions.  If it is useful to give the
function a name, it should be assigned to a local <code>const</code>.</p>

<h4 id="features-functions-arrow-functions" style="left: -46px; position: relative;">5.5.3 Arrow functions<a href="https://google.github.io/styleguide/jsguide.html#features-functions-arrow-functions" alt="link to features-functions-arrow-functions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Arrow functions provide a concise function syntax and simplify scoping <code>this</code>
for nested functions. Prefer arrow functions over the <code>function</code> keyword,
particularly for nested functions (but see
<a href="https://google.github.io/styleguide/jsguide.html#features-objects-method-shorthand">5.3.5 Method shorthand</a>).</p>

<p>Prefer arrow functions over other <code>this</code> scoping approaches such as
<code>f.bind(this)</code>, <code>goog.bind(f, this)</code>, and <code>const self = this</code>. Arrow functions
are particularly useful for calling into callbacks as they permit explicitly
specifying which parameters to pass to the callback whereas binding will blindly
pass along all parameters.</p>

<p>The left-hand side of the arrow contains zero or more parameters. Parentheses
around the parameters are optional if there is only a single non-destructured
parameter. When parentheses are used, inline parameter types may be specified
(see <a href="https://google.github.io/styleguide/jsguide.html#jsdoc-method-and-function-comments">7.8 Method and function comments</a>).</p>

<p class="tip">Tip: Always using parentheses even for single-parameter arrow functions can
avoid situations where adding parameters, but forgetting to add parentheses, may
result in parseable code which no longer works as intended.</p>

<p>The right-hand side of the arrow contains the body of the function. By default
the body is a block statement (zero or more statements surrounded by curly
braces). The body may also be an implicitly returned single expression if
either: the program logic requires returning a value, or the <code>void</code> operator
precedes a single function or method call (using <code>void</code> ensures <code>undefined</code> is
returned, prevents leaking values, and communicates intent). The single
expression form is preferred if it improves readability (e.g., for short or
simple expressions).</p>

<p class="examples">Examples:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Arrow functions can be documented just like normal functions.
 * @param {number} numParam A number to add.
 * @param {string} strParam Another number to add that happens to be a string.
 * @return {number} The sum of the two parameters.
 */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> moduleLocalFunc </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="pln">numParam</span><span class="pun">,</span><span class="pln"> strParam</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> numParam </span><span class="pun">+</span><span class="pln"> </span><span class="typ">Number</span><span class="pun">(</span><span class="pln">strParam</span><span class="pun">);</span><span class="pln">

</span><span class="com">// Uses the single expression syntax with `void` because the program logic does</span><span class="pln">
</span><span class="com">// not require returning a value.</span><span class="pln">
getValue</span><span class="pun">((</span><span class="pln">result</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> alert</span><span class="pun">(`</span><span class="typ">Got</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">result</span><span class="pun">}`));</span><span class="pln">

</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">CallbackExample</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">/** @private {number} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">cachedValue_ </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">

    </span><span class="com">// For inline callbacks, you can use inline typing for parameters.</span><span class="pln">
    </span><span class="com">// Uses a block statement because the value of the single expression should</span><span class="pln">
    </span><span class="com">// not be returned and the expression is not a single function call.</span><span class="pln">
    getNullableValue</span><span class="pun">((</span><span class="com">/** ?number */</span><span class="pln"> result</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">cachedValue_ </span><span class="pun">=</span><span class="pln"> result </span><span class="pun">==</span><span class="pln"> </span><span class="kwd">null</span><span class="pln"> </span><span class="pun">?</span><span class="pln"> </span><span class="lit">0</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> result</span><span class="pun">;</span><span class="pln">
    </span><span class="pun">});</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/**
 * A function with no params and no returned value.
 * This single expression body usage is illegal because the program logic does
 * not require returning a value and we're missing the `void` operator.
 */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> moduleLocalFunc </span><span class="pun">=</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> anotherFunction</span><span class="pun">();</span></pre>

<h4 id="features-functions-generators" style="left: -46px; position: relative;">5.5.4 Generators<a href="https://google.github.io/styleguide/jsguide.html#features-functions-generators" alt="link to features-functions-generators"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Generators enable a number of useful abstractions and may be used as needed.</p>

<p>When defining generator functions, attach the <code>*</code> to the <code>function</code> keyword when
present, and separate it with a space from the name of the function.  When using
delegating yields, attach the <code>*</code> to the <code>yield</code> keyword.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @return {!Iterator&lt;number&gt;} */</span><span class="pln">
</span><span class="kwd">function</span><span class="pun">*</span><span class="pln"> gen1</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">yield</span><span class="pln"> </span><span class="lit">42</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/** @return {!Iterator&lt;number&gt;} */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> gen2 </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">*()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">yield</span><span class="pun">*</span><span class="pln"> gen1</span><span class="pun">();</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SomeClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @return {!Iterator&lt;number&gt;} */</span><span class="pln">
  </span><span class="pun">*</span><span class="pln"> gen</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="kwd">yield</span><span class="pln"> </span><span class="lit">42</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="features-functions-parameter-return-types" style="left: -46px; position: relative;">5.5.5 Parameter and return types<a href="https://google.github.io/styleguide/jsguide.html#features-functions-parameter-return-types" alt="link to features-functions-parameter-return-types"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Function parameters and return types should usually be documented with JSDoc
annotations. See <a href="https://google.github.io/styleguide/jsguide.html#jsdoc-method-and-function-comments">7.8 Method and function comments</a> for more information.</p>

<h5 id="features-functions-default-parameters">5.5.5.1 Default parameters</h5>

<p>Optional parameters are permitted using the equals operator in the parameter
list. Optional parameters must include spaces on both sides of the equals
operator, be named exactly like required parameters (i.e., not prefixed with
<code>opt_</code>), use the <code>=</code> suffix in their JSDoc type, come after required parameters,
and not use initializers that produce observable side effects. All optional
parameters for concrete functions must have default values, even if that value
is <code>undefined</code>. In contrast to concrete functions, abstract and interface
methods must omit default parameter values.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @param {string} required This parameter is always needed.
 * @param {string=} optional This parameter can be omitted.
 * @param {!Node=} node Another optional parameter.
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> maybeDoSomething</span><span class="pun">(</span><span class="pln">required</span><span class="pun">,</span><span class="pln"> optional </span><span class="pun">=</span><span class="pln"> </span><span class="str">''</span><span class="pun">,</span><span class="pln"> node </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">undefined</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">

</span><span class="com">/** @interface */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyInterface</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/**
   * Interface and abstract methods must omit default parameter values.
   * @param {string=} optional
   */</span><span class="pln">
  someMethod</span><span class="pun">(</span><span class="pln">optional</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>Use default parameters sparingly. Prefer destructuring (as in
<a href="https://google.github.io/styleguide/jsguide.html#features-objects-destructuring">5.3.7 Destructuring</a>) to create readable APIs when there
are more than a small handful of optional parameters that do not have a natural
order.</p>

<p class="note">Note: Unlike Python's default parameters, it is okay to use initializers that
return new mutable objects (such as <code>{}</code> or <code>[]</code>) because the initializer is
evaluated each time the default value is used, so a single object won't be
shared across invocations.</p>

<p class="tip">Tip: While arbitrary expressions including function calls may be used as
initializers, these should be kept as simple as possible. Avoid initializers
that expose shared mutable state, as that can easily introduce unintended
coupling between function calls.</p>

<h5 id="features-functions-rest-parameters">5.5.5.2 Rest parameters</h5>

<p>Use a <em>rest</em> parameter instead of accessing <code>arguments</code>. Rest parameters are
typed with a <code>...</code> prefix in their JSDoc. The rest parameter must be the last
parameter in the list. There is no space between the <code>...</code> and the parameter
name.  Do not name the rest parameter <code>var_args</code>. Never name a local variable or
parameter <code>arguments</code>, which confusingly shadows the built-in name.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @param {!Array&lt;string&gt;} array This is an ordinary parameter.
 * @param {...number} numbers The remainder of arguments are all numbers.
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> variadic</span><span class="pun">(</span><span class="pln">array</span><span class="pun">,</span><span class="pln"> </span><span class="pun">...</span><span class="pln">numbers</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span></pre>

<h4 id="features-functions-generics" style="left: -46px; position: relative;">5.5.6 Generics<a href="https://google.github.io/styleguide/jsguide.html#features-functions-generics" alt="link to features-functions-generics"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Declare generic functions and methods when necessary with <code>@template TYPE</code> in
the JSDoc above the function or method definition.</p>

<h4 id="features-functions-spread-operator" style="left: -46px; position: relative;">5.5.7 Spread operator<a href="https://google.github.io/styleguide/jsguide.html#features-functions-spread-operator" alt="link to features-functions-spread-operator"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Function calls may use the spread operator (<code>...</code>).  Prefer the spread operator
to <code>Function.prototype.apply</code> when an array or iterable is unpacked into
multiple parameters of a variadic function.  There is no space after the <code>...</code>.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">function</span><span class="pln"> myFunction</span><span class="pun">(...</span><span class="pln">elements</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
myFunction</span><span class="pun">(...</span><span class="pln">array</span><span class="pun">,</span><span class="pln"> </span><span class="pun">...</span><span class="pln">iterable</span><span class="pun">,</span><span class="pln"> </span><span class="pun">...</span><span class="pln">generator</span><span class="pun">());</span></pre>

<h3 id="features-string-literals" style="left: -46px; position: relative;">5.6 String literals<a href="https://google.github.io/styleguide/jsguide.html#features-string-literals" alt="link to features-string-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-strings-use-single-quotes" style="left: -46px; position: relative;">5.6.1 Use single quotes<a href="https://google.github.io/styleguide/jsguide.html#features-strings-use-single-quotes" alt="link to features-strings-use-single-quotes"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Ordinary string literals are delimited with single quotes (<code>'</code>), rather than
double quotes (<code>"</code>).</p>

<p class="tip">Tip: if a string contains a single quote character, consider using a template
string to avoid having to escape the quote.</p>

<p>Ordinary string literals may not span multiple lines.</p>

<h4 id="features-strings-template-strings" style="left: -46px; position: relative;">5.6.2 Template literals<a href="https://google.github.io/styleguide/jsguide.html#features-strings-template-strings" alt="link to features-strings-template-strings"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Use template literals (delimited with <code>`</code>) over complex string
concatenation, particularly if multiple string literals are involved. Template
literals may span multiple lines.</p>

<p>If a template literal spans multiple lines, it does not need to follow the
indentation of the enclosing block, though it may if the added whitespace does
not matter.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">function</span><span class="pln"> arithmetic</span><span class="pun">(</span><span class="pln">a</span><span class="pun">,</span><span class="pln"> b</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> </span><span class="pun">`</span><span class="typ">Here</span><span class="pln"> is a table </span><span class="kwd">of</span><span class="pln"> arithmetic operations</span><span class="pun">:</span><span class="pln">
$</span><span class="pun">{</span><span class="pln">a</span><span class="pun">}</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">b</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">a </span><span class="pun">+</span><span class="pln"> b</span><span class="pun">}</span><span class="pln">
$</span><span class="pun">{</span><span class="pln">a</span><span class="pun">}</span><span class="pln"> </span><span class="pun">-</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">b</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">a </span><span class="pun">-</span><span class="pln"> b</span><span class="pun">}</span><span class="pln">
$</span><span class="pun">{</span><span class="pln">a</span><span class="pun">}</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">b</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">a </span><span class="pun">*</span><span class="pln"> b</span><span class="pun">}</span><span class="pln">
$</span><span class="pun">{</span><span class="pln">a</span><span class="pun">}</span><span class="pln"> </span><span class="pun">/</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">b</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> $</span><span class="pun">{</span><span class="pln">a </span><span class="pun">/</span><span class="pln"> b</span><span class="pun">}`;</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="features-strings-no-line-continuations" style="left: -46px; position: relative;">5.6.3 No line continuations<a href="https://google.github.io/styleguide/jsguide.html#features-strings-no-line-continuations" alt="link to features-strings-no-line-continuations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not use <em>line continuations</em> (that is, ending a line inside a string literal
with a backslash) in either ordinary or template string literals. Even though
ES5 allows this, it can lead to tricky errors if any trailing whitespace comes
after the slash, and is less obvious to readers.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">const</span><span class="pln"> longString </span><span class="pun">=</span><span class="pln"> </span><span class="str">'</span><span class="typ">This</span><span class="pln"> is a very </span><span class="kwd">long</span><span class="pln"> string that far exceeds the </span><span class="lit">80</span><span class="pln"> \
    column limit</span><span class="pun">.</span><span class="pln"> </span><span class="typ">It</span><span class="pln"> unfortunately contains </span><span class="kwd">long</span><span class="pln"> stretches </span><span class="kwd">of</span><span class="pln"> spaces due \
    to how the continued lines are indented</span><span class="pun">.</span><span class="str">';</span></pre>

<p>Instead, write</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> longString </span><span class="pun">=</span><span class="pln"> </span><span class="str">'This is a very long string that far exceeds the 80 '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
    </span><span class="str">'column limit. It does not contain long stretches of spaces since '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
    </span><span class="str">'the concatenated strings are cleaner.'</span><span class="pun">;</span></pre>

<h3 id="features-number-literals" style="left: -46px; position: relative;">5.7 Number literals<a href="https://google.github.io/styleguide/jsguide.html#features-number-literals" alt="link to features-number-literals"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Numbers may be specified in decimal, hex, octal, or binary.  Use exactly <code>0x</code>,
<code>0o</code>, and <code>0b</code> prefixes, with lowercase letters, for hex, octal, and binary,
respectively.  Never include a leading zero unless it is immediately followed by
<code>x</code>, <code>o</code>, or <code>b</code>.</p>

<h3 id="features-control-structures" style="left: -46px; position: relative;">5.8 Control structures<a href="https://google.github.io/styleguide/jsguide.html#features-control-structures" alt="link to features-control-structures"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="features-for-loops" style="left: -46px; position: relative;">5.8.1 For loops<a href="https://google.github.io/styleguide/jsguide.html#features-for-loops" alt="link to features-for-loops"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>With ES6, the language now has three different kinds of <code>for</code> loops.  All may be
used, though <code>for</code>-<code>of</code> loops should be preferred when possible.</p>

<p><code>for</code>-<code>in</code> loops may only be used on dict-style objects (see
<a href="https://google.github.io/styleguide/jsguide.html#features-objects-mixing-keys">5.3.3 Do not mix quoted and unquoted keys</a>), and should not be used to iterate over an
array.  <code>Object.prototype.hasOwnProperty</code> should be used in <code>for</code>-<code>in</code> loops to
exclude unwanted prototype properties.  Prefer <code>for</code>-<code>of</code> and <code>Object.keys</code> over
<code>for</code>-<code>in</code> when possible.</p>

<h4 id="features-exceptions" style="left: -46px; position: relative;">5.8.2 Exceptions<a href="https://google.github.io/styleguide/jsguide.html#features-exceptions" alt="link to features-exceptions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Exceptions are an important part of the language and should be used whenever
exceptional cases occur.  Always throw <code>Error</code>s or subclasses of <code>Error</code>: never
throw string literals or other objects.  Always use <code>new</code> when constructing an
<code>Error</code>.</p>

<p>This treatment extends to <code>Promise</code> rejection values as <code>Promise.reject(obj)</code> is
equivalent to <code>throw obj;</code> in async functions.</p>

<p>Custom exceptions provide a great way to convey additional error information
from functions.  They should be defined and used wherever the native <code>Error</code>
type is insufficient.</p>

<p>Prefer throwing exceptions over ad-hoc error-handling approaches (such as
passing an error container reference type, or returning an object with an error
property).</p>

<h5 id="features-empty-catch-blocks">5.8.2.1 Empty catch blocks</h5>

<p>It is very rarely correct to do nothing in response to a caught exception. When
it truly is appropriate to take no action whatsoever in a catch block, the
reason this is justified is explained in a comment.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> handleNumericResponse</span><span class="pun">(</span><span class="pln">response</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span><span class="pln"> </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">ok</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// it's not numeric; that's fine, just continue</span><span class="pln">
</span><span class="pun">}</span><span class="pln">
</span><span class="kwd">return</span><span class="pln"> handleTextResponse</span><span class="pun">(</span><span class="pln">response</span><span class="pun">);</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pln">  </span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    shouldFail</span><span class="pun">();</span><span class="pln">
    fail</span><span class="pun">(</span><span class="str">'expected an error'</span><span class="pun">);</span><span class="pln">
  </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">expected</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="pun">}</span></pre>

<p class="tip">Tip: Unlike in some other languages, patterns like the above simply don’t work
since this will catch the error thrown by <code>fail</code>. Use <code>assertThrows()</code> instead.</p>

<h4 id="features-switch-statements" style="left: -46px; position: relative;">5.8.3 Switch statements<a href="https://google.github.io/styleguide/jsguide.html#features-switch-statements" alt="link to features-switch-statements"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Terminology Note: Inside the braces of a switch block are one or more statement groups. Each statement group consists of one or more switch labels (either <code>case FOO:</code> or <code>default:</code>), followed by one or more statements.</p>

<h5 id="features-switch-fall-through">5.8.3.1 Fall-through: commented</h5>

<p>Within a switch block, each statement group either terminates abruptly (with a
<code>break</code>, <code>return</code> or <code>throw</code>n exception), or is marked with a comment to
indicate that execution will or might continue into the next statement
group. Any comment that communicates the idea of fall-through is sufficient
(typically <code>// fall through</code>). This special comment is not required in the last
statement group of the switch block.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">switch</span><span class="pln"> </span><span class="pun">(</span><span class="pln">input</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">case</span><span class="pln"> </span><span class="lit">1</span><span class="pun">:</span><span class="pln">
  </span><span class="kwd">case</span><span class="pln"> </span><span class="lit">2</span><span class="pun">:</span><span class="pln">
    prepareOneOrTwo</span><span class="pun">();</span><span class="pln">
  </span><span class="com">// fall through</span><span class="pln">
  </span><span class="kwd">case</span><span class="pln"> </span><span class="lit">3</span><span class="pun">:</span><span class="pln">
    handleOneTwoOrThree</span><span class="pun">();</span><span class="pln">
    </span><span class="kwd">break</span><span class="pun">;</span><span class="pln">
  </span><span class="kwd">default</span><span class="pun">:</span><span class="pln">
    handleLargeNumber</span><span class="pun">(</span><span class="pln">input</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span></pre>

<h5 id="features-switch-default-case">5.8.3.2 The <code>default</code> case is present</h5>

<p>Each switch statement includes a <code>default</code> statement group, even if it contains
no code. The <code>default</code> statement group must be last.</p>

<h3 id="features-this" style="left: -46px; position: relative;">5.9 this<a href="https://google.github.io/styleguide/jsguide.html#features-this" alt="link to features-this"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Only use <code>this</code> in class constructors and methods, in arrow functions defined
within class constructors and methods, or in functions that have an explicit
<code>@this</code> declared in the immediately-enclosing function’s JSDoc.</p>

<p>Never use <code>this</code> to refer to the global object, the context of an <code>eval</code>, the
target of an event, or unnecessarily <code>call()</code>ed or <code>apply()</code>ed functions.</p>

<h3 id="features-equality-checks" style="left: -46px; position: relative;">5.10 Equality Checks<a href="https://google.github.io/styleguide/jsguide.html#features-equality-checks" alt="link to features-equality-checks"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Use identity operators (<code>===</code>/<code>!==</code>) except in the cases documented below.</p>

<h4 id="features-equality-checks-exceptions" style="left: -46px; position: relative;">5.10.1 Exceptions Where Coercion is Desirable<a href="https://google.github.io/styleguide/jsguide.html#features-equality-checks-exceptions" alt="link to features-equality-checks-exceptions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Catching both <code>null</code> and <code>undefined</code> values:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">someObjectOrPrimitive </span><span class="pun">==</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// Checking for null catches both null and undefined for objects and</span><span class="pln">
  </span><span class="com">// primitives, but does not catch other falsy values like 0 or the empty</span><span class="pln">
  </span><span class="com">// string.</span><span class="pln">
</span><span class="pun">}</span></pre>

<h3 id="disallowed-features" style="left: -46px; position: relative;">5.11 Disallowed features<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features" alt="link to disallowed-features"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="disallowed-features-with" style="left: -46px; position: relative;">5.11.1 with<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-with" alt="link to disallowed-features-with"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not use the <code>with</code> keyword.  It makes your code harder to understand and has
been banned in strict mode since ES5.</p>

<h4 id="disallowed-features-dynamic-code-evaluation" style="left: -46px; position: relative;">5.11.2 Dynamic code evaluation<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-dynamic-code-evaluation" alt="link to disallowed-features-dynamic-code-evaluation"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not use <code>eval</code> or the <code>Function(...string)</code> constructor (except for code
loaders).  These features are potentially dangerous and simply do not work in
CSP environments.</p>

<h4 id="disallowed-features-automatic-semicolon-insertion" style="left: -46px; position: relative;">5.11.3 Automatic semicolon insertion<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-automatic-semicolon-insertion" alt="link to disallowed-features-automatic-semicolon-insertion"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Always terminate statements with semicolons (except function and class
declarations, as noted above).</p>

<h4 id="disallowed-features-non-standard-features" style="left: -46px; position: relative;">5.11.4 Non-standard features<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-non-standard-features" alt="link to disallowed-features-non-standard-features"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do not use non-standard features.  This includes old features that have been
removed (e.g., <code>WeakMap.clear</code>), new features that are not yet standardized
(e.g., the current TC39 working draft, proposals at any stage, or proposed but
not-yet-complete web standards), or proprietary features that are only
implemented in some browsers.  Use only features defined in the current ECMA-262
or WHATWG standards.  (Note that projects writing against specific APIs, such as
Chrome extensions or Node.js, can obviously use those APIs).  Non-standard
language “extensions” (such as those provided by some external transpilers) are
forbidden.</p>

<h4 id="disallowed-features-wrapper-objects" style="left: -46px; position: relative;">5.11.5 Wrapper objects for primitive types<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-wrapper-objects" alt="link to disallowed-features-wrapper-objects"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Never use <code>new</code> on the primitive object wrappers (<code>Boolean</code>, <code>Number</code>, <code>String</code>,
<code>Symbol</code>), nor include them in type annotations.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** Boolean */</span><span class="pln"> x </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Boolean</span><span class="pun">(</span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x</span><span class="pun">)</span><span class="pln"> alert</span><span class="pun">(</span><span class="kwd">typeof</span><span class="pln"> x</span><span class="pun">);</span><span class="pln">  </span><span class="com">// alerts 'object' - WAT?</span></pre>

<p>The wrappers may be called as functions for coercing (which is preferred over
using <code>+</code> or concatenating the empty string) or creating symbols.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** boolean */</span><span class="pln"> x </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Boolean</span><span class="pun">(</span><span class="lit">0</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="pln">x</span><span class="pun">)</span><span class="pln"> alert</span><span class="pun">(</span><span class="kwd">typeof</span><span class="pln"> x</span><span class="pun">);</span><span class="pln">  </span><span class="com">// alerts 'boolean', as expected</span></pre>

<h4 id="disallowed-features-modifying-builtin-objects" style="left: -46px; position: relative;">5.11.6 Modifying builtin objects<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-modifying-builtin-objects" alt="link to disallowed-features-modifying-builtin-objects"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Never modify builtin types, either by adding methods to their constructors or to
their prototypes.  Avoid depending on libraries that do this.  Note that the
JSCompiler’s runtime library will provide standards-compliant polyfills where
possible; nothing else may modify builtin objects.</p>

<p>Do not add symbols to the global object unless absolutely necessary
(e.g. required by a third-party API).</p>

<h4 id="disallowed-features-omitting-parents-with-new" style="left: -46px; position: relative;">5.11.7 Omitting <code>()</code> when invoking a constructor<a href="https://google.github.io/styleguide/jsguide.html#disallowed-features-omitting-parents-with-new" alt="link to disallowed-features-omitting-parents-with-new"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Never invoke a constructor in a <code>new</code> statement without using parentheses <code>()</code>.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">new</span><span class="pln"> </span><span class="typ">Foo</span><span class="pun">;</span></pre>

<p>Use instead:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">new</span><span class="pln"> </span><span class="typ">Foo</span><span class="pun">();</span></pre>

<p>Omitting parentheses can lead to subtle mistakes. These two lines are not
equivalent:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">new</span><span class="pln"> </span><span class="typ">Foo</span><span class="pun">().</span><span class="typ">Bar</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Foo</span><span class="pun">.</span><span class="typ">Bar</span><span class="pun">();</span></pre>

<h2 id="naming" style="left: -46px; position: relative;">6 Naming<a href="https://google.github.io/styleguide/jsguide.html#naming" alt="link to naming"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<h3 id="naming-rules-common-to-all-identifiers" style="left: -46px; position: relative;">6.1 Rules common to all identifiers<a href="https://google.github.io/styleguide/jsguide.html#naming-rules-common-to-all-identifiers" alt="link to naming-rules-common-to-all-identifiers"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Identifiers use only ASCII letters and digits, and, in a small number of cases
noted below, underscores and very rarely (when required by frameworks like
Angular) dollar signs.</p>

<p>Give as descriptive a name as possible, within reason. Do not worry about saving
horizontal space as it is far more important to make your code immediately
understandable by a new reader. Do not use abbreviations that are ambiguous or
unfamiliar to readers outside your project, and do not abbreviate by deleting
letters within a word.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">errorCount          </span><span class="com">// No abbreviation.</span><span class="pln">
dnsConnectionIndex  </span><span class="com">// Most people know what "DNS" stands for.</span><span class="pln">
referrerUrl         </span><span class="com">// Ditto for "URL".</span><span class="pln">
customerId          </span><span class="com">// "Id" is both ubiquitous and unlikely to be misunderstood.</span></pre>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pln">n                   </span><span class="com">// Meaningless.</span><span class="pln">
nErr                </span><span class="com">// Ambiguous abbreviation.</span><span class="pln">
nCompConns          </span><span class="com">// Ambiguous abbreviation.</span><span class="pln">
wgcConnections      </span><span class="com">// Only your group knows what this stands for.</span><span class="pln">
pcReader            </span><span class="com">// Lots of things can be abbreviated "pc".</span><span class="pln">
cstmrId             </span><span class="com">// Deletes internal letters.</span><span class="pln">
kSecondsPerDay      </span><span class="com">// Do not use Hungarian notation.</span></pre>

<h3 id="naming-rules-by-identifier-type" style="left: -46px; position: relative;">6.2 Rules by identifier type<a href="https://google.github.io/styleguide/jsguide.html#naming-rules-by-identifier-type" alt="link to naming-rules-by-identifier-type"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="naming-package-names" style="left: -46px; position: relative;">6.2.1 Package names<a href="https://google.github.io/styleguide/jsguide.html#naming-package-names" alt="link to naming-package-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Package names are all <code>lowerCamelCase</code>. For example,
<code>my.exampleCode.deepSpace</code>, but not <code class="badcode">my.examplecode.deepspace</code> or <code class="badcode">my.example_code.deep_space</code>.</p>

<h4 id="naming-class-names" style="left: -46px; position: relative;">6.2.2 Class names<a href="https://google.github.io/styleguide/jsguide.html#naming-class-names" alt="link to naming-class-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Class, interface, record, and typedef names are written in <code>UpperCamelCase</code>.
Unexported classes are simply locals: they are not marked <code>@private</code> and
therefore are not named with a trailing underscore.</p>

<p>Type names are typically nouns or noun phrases. For example, <code>Request</code>,
<code>ImmutableList</code>, or <code>VisibilityMode</code>.  Additionally, interface names may
sometimes be adjectives or adjective phrases instead (for example, <code>Readable</code>).</p>

<h4 id="naming-method-names" style="left: -46px; position: relative;">6.2.3 Method names<a href="https://google.github.io/styleguide/jsguide.html#naming-method-names" alt="link to naming-method-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Method names are written in <code>lowerCamelCase</code>. Names for <code>@private</code> methods must
end with a trailing underscore.</p>

<p>Method names are typically verbs or verb phrases. For example, <code>sendMessage</code> or
<code>stop_</code>.  Getter and setter methods for properties are never required, but if
they are used they should be named <code>getFoo</code> (or optionally <code>isFoo</code> or <code>hasFoo</code>
for booleans), or <code>setFoo(value)</code> for setters.</p>

<p>Underscores may also appear in JsUnit test method names to separate logical
components of the name. One typical pattern is
<code>test&lt;MethodUnderTest&gt;_&lt;state&gt;_&lt;expectedOutcome&gt;</code>, for example
<code>testPop_emptyStack_throws</code>. There is no One Correct Way to name test methods.</p>

<h4 id="naming-enum-names" style="left: -46px; position: relative;">6.2.4 Enum names<a href="https://google.github.io/styleguide/jsguide.html#naming-enum-names" alt="link to naming-enum-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Enum names are written in <code>UpperCamelCase</code>, similar to classes, and should
generally be singular nouns.  Individual items within the enum are named in
<code>CONSTANT_CASE</code>.</p>

<h4 id="naming-constant-names" style="left: -46px; position: relative;">6.2.5 Constant names<a href="https://google.github.io/styleguide/jsguide.html#naming-constant-names" alt="link to naming-constant-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Constant names use <code>CONSTANT_CASE</code>: all uppercase letters, with words separated
by underscores. There is no reason for a constant to be named with a trailing
underscore, since private static properties can be replaced by (implicitly
private) module locals.</p>

<h5 id="naming-definition-of-constant">6.2.5.1 Definition of “constant”</h5>

<p>Every constant is a <code>@const</code> static property or a module-local <code>const</code>
declaration, but not all <code>@const</code> static properties and module-local <code>const</code>s
are constants. Before choosing constant case, consider whether the field really
feels like a <em>deeply immutable</em> constant. For example, if any of that instance's
observable state can change, it is almost certainly not a constant. Merely
intending to never mutate the object is generally not enough.</p>

<p class="examples">Examples:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">// Constants</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> NUMBER </span><span class="pun">=</span><span class="pln"> </span><span class="lit">5</span><span class="pun">;</span><span class="pln">
</span><span class="com">/** @const */</span><span class="pln"> exports</span><span class="pun">.</span><span class="pln">NAMES </span><span class="pun">=</span><span class="pln"> </span><span class="typ">ImmutableList</span><span class="pun">.</span><span class="kwd">of</span><span class="pun">(</span><span class="str">'Ed'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'Ann'</span><span class="pun">);</span><span class="pln">
</span><span class="com">/** @enum */</span><span class="pln"> exports</span><span class="pun">.</span><span class="typ">SomeEnum</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> ENUM_CONSTANT</span><span class="pun">:</span><span class="pln"> </span><span class="str">'value'</span><span class="pln"> </span><span class="pun">};</span><span class="pln">

</span><span class="com">// Not constants</span><span class="pln">
</span><span class="kwd">let</span><span class="pln"> letVariable </span><span class="pun">=</span><span class="pln"> </span><span class="str">'non-const'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">constructor</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">/** @const {string} */</span><span class="pln"> </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">nonStatic </span><span class="pun">=</span><span class="pln"> </span><span class="str">'non-static'</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">};</span><span class="pln">
</span><span class="com">/** @type {string} */</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pun">.</span><span class="pln">staticButMutable </span><span class="pun">=</span><span class="pln"> </span><span class="str">'not @const, can be reassigned'</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** Set&lt;string&gt; */</span><span class="pln"> mutableCollection </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Set</span><span class="pun">();</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** ImmutableSet&lt;SomeMutableType&gt; */</span><span class="pln"> mutableElements </span><span class="pun">=</span><span class="pln"> </span><span class="typ">ImmutableSet</span><span class="pun">.</span><span class="kwd">of</span><span class="pun">(</span><span class="pln">mutable</span><span class="pun">);</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">Foo</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'my.Foo'</span><span class="pun">);</span><span class="pln">  </span><span class="com">// mirrors imported name</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> logger </span><span class="pun">=</span><span class="pln"> log</span><span class="pun">.</span><span class="pln">getLogger</span><span class="pun">(</span><span class="str">'loggers.are.not.immutable'</span><span class="pun">);</span></pre>

<p>Constants’ names are typically nouns or noun phrases.</p>

<h5 id="naming-local-aliases">6.2.5.2 Local aliases</h5>

<p>Local aliases should be used whenever they improve readability over
fully-qualified names.  Follow the same rules as <code>goog.require</code>s
(<a href="https://google.github.io/styleguide/jsguide.html#file-goog-require">3.6 goog.require and goog.requireType statements</a>), maintaining the last part of the aliased name.
Aliases may also be used within functions.  Aliases must be <code>const</code>.</p>

<p class="examples">Examples:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> staticHelper </span><span class="pun">=</span><span class="pln"> importedNamespace</span><span class="pun">.</span><span class="pln">staticHelper</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> CONSTANT_NAME </span><span class="pun">=</span><span class="pln"> </span><span class="typ">ImportedClass</span><span class="pun">.</span><span class="pln">CONSTANT_NAME</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="pun">{</span><span class="pln">assert</span><span class="pun">,</span><span class="pln"> assertInstanceof</span><span class="pun">}</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> asserts</span><span class="pun">;</span></pre>

<h4 id="naming-non-constant-field-names" style="left: -46px; position: relative;">6.2.6 Non-constant field names<a href="https://google.github.io/styleguide/jsguide.html#naming-non-constant-field-names" alt="link to naming-non-constant-field-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Non-constant field names (static or otherwise) are written in <code>lowerCamelCase</code>,
with a trailing underscore for private fields.</p>

<p>These names are typically nouns or noun phrases. For example, <code>computedValues</code>
or <code>index_</code>.</p>

<h4 id="naming-parameter-names" style="left: -46px; position: relative;">6.2.7 Parameter names<a href="https://google.github.io/styleguide/jsguide.html#naming-parameter-names" alt="link to naming-parameter-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Parameter names are written in <code>lowerCamelCase</code>.  Note that this applies even if
the parameter expects a constructor.</p>

<p>One-character parameter names should not be used in public methods.</p>

<p class="exception"><strong>Exception</strong>: When required by a third-party framework, parameter names may
begin with a <code>$</code>.  This exception does not apply to any other identifiers
(e.g. local variables or properties).</p>

<h4 id="naming-local-variable-names" style="left: -46px; position: relative;">6.2.8 Local variable names<a href="https://google.github.io/styleguide/jsguide.html#naming-local-variable-names" alt="link to naming-local-variable-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Local variable names are written in <code>lowerCamelCase</code>, except for module-local
(top-level) constants, as described above. Constants in function scopes are
still named in <code>lowerCamelCase</code>. Note that <code>lowerCamelCase</code> is used
even if the variable holds a constructor.</p>

<h4 id="naming-template-parameter-names" style="left: -46px; position: relative;">6.2.9 Template parameter names<a href="https://google.github.io/styleguide/jsguide.html#naming-template-parameter-names" alt="link to naming-template-parameter-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Template parameter names should be concise, single-word or single-letter
identifiers, and must be all-caps, such as <code>TYPE</code> or <code>THIS</code>.</p>

<h4 id="naming-module-local-names" style="left: -46px; position: relative;">6.2.10 Module-local names<a href="https://google.github.io/styleguide/jsguide.html#naming-module-local-names" alt="link to naming-module-local-names"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Module-local names that are not exported are implicitly private. They are not
marked <code>@private</code> and do not end in an underscore. This applies to classes,
functions, variables, constants, enums, and other module-local identifiers.</p>

<h3 id="naming-camel-case-defined" style="left: -46px; position: relative;">6.3 Camel case: defined<a href="https://google.github.io/styleguide/jsguide.html#naming-camel-case-defined" alt="link to naming-camel-case-defined"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Sometimes there is more than one reasonable way to convert an English phrase
into camel case, such as when acronyms or unusual constructs like <q>IPv6</q> or
<q>iOS</q> are present. To improve predictability, Google Style specifies the
following (nearly) deterministic scheme.</p>

<p>Beginning with the prose form of the name:</p>

<ol>
<li>Convert the phrase to plain ASCII and remove any apostrophes. For example,
<q>Müller's algorithm</q> might become <q>Muellers algorithm</q>.</li>
<li>Divide this result into words, splitting on spaces and any remaining
punctuation (typically hyphens).
<ol>
<li>Recommended: if any word already has a conventional camel case
appearance in common usage, split this into its constituent parts (e.g.,
<q>AdWords</q> becomes <q>ad words</q>). Note that a word such as <q>iOS</q> is not
really in camel case per se; it defies any convention, so this
recommendation does not apply.</li>
</ol></li>
<li>Now lowercase everything (including acronyms), then uppercase only the first
character of:
<ol>
<li>… each word, to yield upper camel case, or</li>
<li>… each word except the first, to yield lower camel case</li>
</ol></li>
<li>Finally, join all the words into a single identifier.</li>
</ol>

<p>Note that the casing of the original words is almost entirely disregarded.</p>

<p class="examples">Examples:</p>

<table>
<thead>
<tr>
<th style="text-align: center">Prose form</th>
<th style="text-align: center">Correct</th>
<th style="text-align: center">Incorrect</th>
</tr>
</thead>

<tbody>
<tr>
<td style="text-align: center"><q>XML HTTP request</q></td>
<td style="text-align: center">XmlHttpRequest</td>
<td style="text-align: center">XMLHTTPRequest</td>
</tr>
<tr>
<td style="text-align: center"><q>new customer ID</q></td>
<td style="text-align: center">newCustomerId</td>
<td style="text-align: center">newCustomerID</td>
</tr>
<tr>
<td style="text-align: center"><q>inner stopwatch</q></td>
<td style="text-align: center">innerStopwatch</td>
<td style="text-align: center">innerStopWatch</td>
</tr>
<tr>
<td style="text-align: center"><q>supports IPv6 on iOS?</q></td>
<td style="text-align: center">supportsIpv6OnIos</td>
<td style="text-align: center">supportsIPv6OnIOS</td>
</tr>
<tr>
<td style="text-align: center"><q>YouTube importer</q></td>
<td style="text-align: center">YouTubeImporter</td>
<td style="text-align: center">YoutubeImporter*</td>
</tr>
</tbody>
</table>

<p>*Acceptable, but not recommended.</p>

<p class="note">Note: Some words are ambiguously hyphenated in the English language: for example <q>nonempty</q> and <q>non-empty</q> are both correct, so the method names checkNonempty and checkNonEmpty are likewise both correct.</p>

<h2 id="jsdoc" style="left: -46px; position: relative;">7 JSDoc<a href="https://google.github.io/styleguide/jsguide.html#jsdoc" alt="link to jsdoc"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<p><a href="https://developers.google.com/closure/compiler/docs/js-for-compiler">JSDoc</a> is used on all classes, fields, and methods.</p>

<h3 id="jsdoc-general-form" style="left: -46px; position: relative;">7.1 General form<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-general-form" alt="link to jsdoc-general-form"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>The basic formatting of JSDoc blocks is as seen in this example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Multiple lines of JSDoc text are written here,
 * wrapped normally.
 * @param {number} arg A number to do something to.
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> doSomething</span><span class="pun">(</span><span class="pln">arg</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">…</span><span class="pln"> </span><span class="pun">}</span></pre>

<p>or in this single-line example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @const @private {!Foo} A short bit of JSDoc. */</span><span class="pln">
</span><span class="kwd">this</span><span class="pun">.</span><span class="pln">foo_ </span><span class="pun">=</span><span class="pln"> foo</span><span class="pun">;</span></pre>

<p>If a single-line comment overflows into multiple lines, it must use the
multi-line style with <code>/**</code> and <code>*/</code> on their own lines.</p>

<p>Many tools extract metadata from JSDoc comments to perform code validation and
optimization.  As such, these comments <strong>must</strong> be well-formed.</p>

<h3 id="jsdoc-markdown" style="left: -46px; position: relative;">7.2 Markdown<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-markdown" alt="link to jsdoc-markdown"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>JSDoc is written in Markdown, though it may include HTML when necessary.</p>

<p>Note that tools that automatically extract JSDoc (e.g. <a href="https://github.com/jleyba/js-dossier">JsDossier</a>) will often
ignore plain text formatting, so if you did this:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/**
 * Computes weight based on three factors:
 *   items sent
 *   items received
 *   last timestamp
 */</span></pre>

<p>it would come out like this:</p>

<pre class="">Computes weight based on three factors: items sent items received last timestamp
</pre>

<p>Instead, write a Markdown list:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Computes weight based on three factors:
 *
 *  - items sent
 *  - items received
 *  - last timestamp
 */</span></pre>

<h3 id="jsdoc-tags" style="left: -46px; position: relative;">7.3 JSDoc tags<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-tags" alt="link to jsdoc-tags"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Google style allows a subset of JSDoc tags.  See
<a href="https://google.github.io/styleguide/jsguide.html#appendices-jsdoc-tag-reference">9.1 JSDoc tag reference</a> for the complete list.  Most tags must
occupy their own line, with the tag at the beginning of the line.</p>

<p class="disallowed">Disallowed:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/**
 * The "param" tag must occupy its own line and may not be combined.
 * @param {number} left @param {number} right
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> add</span><span class="pun">(</span><span class="pln">left</span><span class="pun">,</span><span class="pln"> right</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span></pre>

<p>Simple tags that do not require any additional data (such as <code>@private</code>,
<code>@const</code>, <code>@final</code>, <code>@export</code>) may be combined onto the same line, along with an
optional type when appropriate.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Place more complex annotations (like "implements" and "template")
 * on their own lines.  Multiple simple tags (like "export" and "final")
 * may be combined in one line.
 * @export @final
 * @implements {Iterable&lt;TYPE&gt;}
 * @template TYPE
 */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/**
   * @param {!ObjType} obj Some object.
   * @param {number=} num An optional number.
   */</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">(</span><span class="pln">obj</span><span class="pun">,</span><span class="pln"> num </span><span class="pun">=</span><span class="pln"> </span><span class="lit">42</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">/** @private @const {!Array&lt;!ObjType|number&gt;} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">data_ </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">obj</span><span class="pun">,</span><span class="pln"> num</span><span class="pun">];</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>There is no hard rule for when to combine tags, or in which order, but be
consistent.</p>

<p>For general information about annotating types in JavaScript see
<a href="https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler">Annotating JavaScript for the Closure Compiler</a> and <a href="https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System">Types in the Closure Type
System</a>.</p>

<h3 id="jsdoc-line-wrapping" style="left: -46px; position: relative;">7.4 Line wrapping<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-line-wrapping" alt="link to jsdoc-line-wrapping"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Line-wrapped block tags are indented four spaces.  Wrapped description text may
be lined up with the description on previous lines, but this horizontal
alignment is discouraged.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Illustrates line wrapping for long param/return descriptions.
 * @param {string} foo This is a param with a description too long to fit in
 *     one line.
 * @return {number} This returns something that has a description too long to
 *     fit in one line.
 */</span><span class="pln">
exports</span><span class="pun">.</span><span class="pln">method </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(</span><span class="pln">foo</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> </span><span class="lit">5</span><span class="pun">;</span><span class="pln">
</span><span class="pun">};</span></pre>

<p>Do not indent when wrapping a <code>@desc</code> or <code>@fileoverview</code> description.</p>

<h3 id="jsdoc-top-file-level-comments" style="left: -46px; position: relative;">7.5 Top/file-level comments<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-top-file-level-comments" alt="link to jsdoc-top-file-level-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>A file may have a top-level file overview. A copyright notice , author information, and
default <a href="https://google.github.io/styleguide/jsguide.html#jsdoc-visibility-annotations">visibility level</a> are optional.  File overviews are generally recommended whenever a
file consists of more than a single class definition. The top level comment is
designed to orient readers unfamiliar with the code to what is in this file. If
present, it may provide a description of the file's contents and any
dependencies or compatibility information. Wrapped lines are not indented.</p>

<p class="example">Example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @fileoverview Description of file, its uses and information
 * about its dependencies.
 * @package
 */</span></pre>

<h3 id="jsdoc-class-comments" style="left: -46px; position: relative;">7.6 Class comments<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-class-comments" alt="link to jsdoc-class-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Classes, interfaces and records must be documented with a description and any
template parameters, implemented interfaces, visibility, or other appropriate
tags. The class description should provide the reader with enough information to
know how and when to use the class, as well as any additional considerations
necessary to correctly use the class. Textual descriptions may be omitted on the
constructor. <code>@constructor</code> and <code>@extends</code> annotations are not used with the
<code>class</code> keyword unless the class is being used to declare an <code>@interface</code> or
it extends a generic class.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * A fancier event target that does cool things.
 * @implements {Iterable&lt;string&gt;}
 */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyFancyTarget</span><span class="pln"> extends </span><span class="typ">EventTarget</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/**
   * @param {string} arg1 An argument that makes this more interesting.
   * @param {!Array&lt;number&gt;} arg2 List of numbers to be processed.
   */</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">(</span><span class="pln">arg1</span><span class="pun">,</span><span class="pln"> arg2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">// ...</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">};</span><span class="pln">

</span><span class="com">/**
 * Records are also helpful.
 * @extends {Iterator&lt;TYPE&gt;}
 * @record
 * @template TYPE
 */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Listable</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @return {TYPE} The next item in line to be returned. */</span><span class="pln">
  next</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
</span><span class="pun">}</span></pre>

<h3 id="jsdoc-enum-and-typedef-comments" style="left: -46px; position: relative;">7.7 Enum and typedef comments<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-enum-and-typedef-comments" alt="link to jsdoc-enum-and-typedef-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>All enums and typedefs must be documented with appropriate JSDoc tags
(<code>@typedef</code> or <code>@enum</code>) on the preceding line. Public enums and typedefs must
also have a description. Individual enum items may be documented with a JSDoc
comment on the preceding line.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * A useful type union, which is reused often.
 * @typedef {!Bandersnatch|!BandersnatchType}
 */</span><span class="pln">
</span><span class="kwd">let</span><span class="pln"> </span><span class="typ">CoolUnionType</span><span class="pun">;</span><span class="pln">


</span><span class="com">/**
 * Types of bandersnatches.
 * @enum {string}
 */</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="typ">BandersnatchType</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** This kind is really frumious. */</span><span class="pln">
  FRUMIOUS</span><span class="pun">:</span><span class="pln"> </span><span class="str">'frumious'</span><span class="pun">,</span><span class="pln">
  </span><span class="com">/** The less-frumious kind. */</span><span class="pln">
  MANXOME</span><span class="pun">:</span><span class="pln"> </span><span class="str">'manxome'</span><span class="pun">,</span><span class="pln">
</span><span class="pun">};</span></pre>

<p>Typedefs are useful for defining short record types, or aliases for unions,
complex functions, or generic types.
Typedefs should be avoided for record types with many fields, since they do not
allow documenting individual fields, nor using templates or recursive
references.
For large record types, prefer <code>@record</code>.</p>

<h3 id="jsdoc-method-and-function-comments" style="left: -46px; position: relative;">7.8 Method and function comments<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-method-and-function-comments" alt="link to jsdoc-method-and-function-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>In methods and named functions, parameter and return types must be documented,
except in the case of same-signature <code>@override</code>s, where all types are omitted.
The <code>this</code> type should be documented when necessary. Return type may be omitted
if the function has no non-empty <code>return</code> statements.</p>

<p>Method, parameter, and return descriptions (but not types) may be omitted if
they are obvious from the rest of the method’s JSDoc or from its signature.</p>

<p>Method descriptions begin with a verb phrase that describes what the method
does. This phrase is not an imperative sentence, but instead is written in the
third person, as if there is an implied <q>This method ...</q> before it.</p>

<p>If a method overrides a superclass method, it must include an <code>@override</code>
annotation. Overridden methods inherit all JSDoc annotations from the super
class method (including visibility annotations) and they should be omitted in
the overridden method. However, if any type is refined in type annotations, all
<code>@param</code> and <code>@return</code> annotations must be specified explicitly.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** A class that does something. */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SomeClass</span><span class="pln"> extends </span><span class="typ">SomeBaseClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/**
   * Operates on an instance of MyClass and returns something.
   * @param {!MyClass} obj An object that for some reason needs detailed
   *     explanation that spans multiple lines.
   * @param {!OtherClass} obviousOtherClass
   * @return {boolean} Whether something occurred.
   */</span><span class="pln">
  someMethod</span><span class="pun">(</span><span class="pln">obj</span><span class="pun">,</span><span class="pln"> obviousOtherClass</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span><span class="pln">

  </span><span class="com">/** @override */</span><span class="pln">
  overriddenMethod</span><span class="pun">(</span><span class="pln">param</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/**
 * Demonstrates how top-level functions follow the same rules.  This one
 * makes an array.
 * @param {TYPE} arg
 * @return {!Array&lt;TYPE&gt;}
 * @template TYPE
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> makeArray</span><span class="pun">(</span><span class="pln">arg</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">}</span></pre>

<p>If you only need to document the param and return types of a function, you may
optionally use inline JSDocs in the function's signature. These inline JSDocs
specify the return and param types without tags.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">function</span><span class="pln"> </span><span class="com">/** string */</span><span class="pln"> foo</span><span class="pun">(</span><span class="com">/** number */</span><span class="pln"> arg</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{...}</span></pre>

<p>If you need descriptions or tags, use a single JSDoc comment above the method.
For example, methods which return values need a <code>@return</code> tag.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/**
   * @param {number} arg
   * @return {string}
   */</span><span class="pln">
  bar</span><span class="pun">(</span><span class="pln">arg</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{...}</span><span class="pln">
</span><span class="pun">}</span></pre>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">// Illegal inline JSDocs.</span><span class="pln">

</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @return {string} */</span><span class="pln"> foo</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{...}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/** Function description. */</span><span class="pln"> bar</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{...}</span></pre>



<p>In anonymous functions annotations are generally optional. If the automatic type
inference is insufficient or explicit annotation improves readability, then
annotate param and return types like this:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">promise</span><span class="pun">.</span><span class="pln">then</span><span class="pun">(</span><span class="pln">
    </span><span class="com">/** @return {string} */</span><span class="pln">
    </span><span class="pun">(</span><span class="com">/** !Array&lt;string&gt; */</span><span class="pln"> items</span><span class="pun">)</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
      doSomethingWith</span><span class="pun">(</span><span class="pln">items</span><span class="pun">);</span><span class="pln">
      </span><span class="kwd">return</span><span class="pln"> items</span><span class="pun">[</span><span class="lit">0</span><span class="pun">];</span><span class="pln">
    </span><span class="pun">});</span></pre>

<p>For function type expressions, see <a href="https://google.github.io/styleguide/jsguide.html#jsdoc-function-types">7.10.4 Function type expressions</a>.</p>

<h3 id="jsdoc-property-comments" style="left: -46px; position: relative;">7.9 Property comments<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-property-comments" alt="link to jsdoc-property-comments"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Property types must be documented. The description may be omitted for private
properties, if name and type provide enough documentation for understanding the
code.</p>

<p>Publicly exported constants are commented the same way as properties.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** My class. */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">MyClass</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">/** @param {string=} someString */</span><span class="pln">
  </span><span class="kwd">constructor</span><span class="pun">(</span><span class="pln">someString </span><span class="pun">=</span><span class="pln"> </span><span class="str">'default string'</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">/** @private @const {string} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">someString_ </span><span class="pun">=</span><span class="pln"> someString</span><span class="pun">;</span><span class="pln">

    </span><span class="com">/** @private @const {!OtherType} */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">someOtherThing_ </span><span class="pun">=</span><span class="pln"> functionThatReturnsAThing</span><span class="pun">();</span><span class="pln">

    </span><span class="com">/**
     * Maximum number of things per pane.
     * @type {number}
     */</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">someProperty </span><span class="pun">=</span><span class="pln"> </span><span class="lit">4</span><span class="pun">;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/**
 * The number of times we'll try before giving up.
 * @const {number}
 */</span><span class="pln">
</span><span class="typ">MyClass</span><span class="pun">.</span><span class="pln">RETRY_COUNT </span><span class="pun">=</span><span class="pln"> </span><span class="lit">33</span><span class="pun">;</span></pre>

<h3 id="jsdoc-type-annotations" style="left: -46px; position: relative;">7.10 Type annotations<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-type-annotations" alt="link to jsdoc-type-annotations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Type annotations are found on <code>@param</code>, <code>@return</code>, <code>@this</code>, and <code>@type</code> tags,
and optionally on <code>@const</code>, <code>@export</code>, and any visibility tags.  Type
annotations attached to JSDoc tags must always be enclosed in braces.</p>

<h4 id="jsdoc-nullability" style="left: -46px; position: relative;">7.10.1 Nullability<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-nullability" alt="link to jsdoc-nullability"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The type system defines modifiers <code>!</code> and <code>?</code> for non-null and nullable,
respectively. These modifiers must precede the type.</p>

<p>Nullability modifiers have different requirements for different types, which
fall into two broad categories:</p>

<ol>
<li>Type annotations for primitives (<code>string</code>, <code>number</code>, <code>boolean</code>, <code>symbol</code>,
<code>undefined</code>, <code>null</code>) and literals (<code>{function(...): ...}</code> and <code>{{foo:
string...}}</code>) are always non-nullable by default. Use the <code>?</code> modifier to
make it nullable, but omit the redundant <code>!</code>.</li>
<li>Reference types (generally, anything in <code>UpperCamelCase</code>, including
<code>some.namespace.ReferenceType</code>) refer to a class, enum, record, or typedef
defined elsewhere. Since these types may or may not be nullable, it is
impossible to tell from the name alone whether it is nullable or not. Always
use explicit <code>?</code> and <code>!</code> modifiers for these types to prevent ambiguity at
use sites.</li>
</ol>

<p class="bad">Bad:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** MyObject */</span><span class="pln"> myObject </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"> </span><span class="com">// Non-primitive types must be annotated.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !number */</span><span class="pln"> someNum </span><span class="pun">=</span><span class="pln"> </span><span class="lit">5</span><span class="pun">;</span><span class="pln"> </span><span class="com">// Primitives are non-nullable by default.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** number? */</span><span class="pln"> someNullableNum </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln"> </span><span class="com">// ? should precede the type.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !{foo: string, bar: number} */</span><span class="pln"> record </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span><span class="pln"> </span><span class="com">// Already non-nullable.</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** MyTypeDef */</span><span class="pln"> def </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span><span class="pln"> </span><span class="com">// Not sure if MyTypeDef is nullable.</span><span class="pln">

</span><span class="com">// Not sure if object (nullable), enum (non-nullable, unless otherwise</span><span class="pln">
</span><span class="com">// specified), or typedef (depends on definition).</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** SomeCamelCaseName */</span><span class="pln"> n </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span></pre>

<p class="good">Good:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** ?MyObject */</span><span class="pln"> myObject </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** number */</span><span class="pln"> someNum </span><span class="pun">=</span><span class="pln"> </span><span class="lit">5</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** ?number */</span><span class="pln"> someNullableNum </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** {foo: string, bar: number} */</span><span class="pln"> record </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !MyTypeDef */</span><span class="pln"> def </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** ?SomeCamelCaseName */</span><span class="pln"> n </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span></pre>

<h4 id="jsdoc-type-casts" style="left: -46px; position: relative;">7.10.2 Type Casts<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-type-casts" alt="link to jsdoc-type-casts"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>In cases where the compiler doesn't accurately infer the type of an expression,
and the assertion functions in
<a href="https://google.github.io/closure-library/api/goog.asserts.html">goog.asserts</a>
cannot remedy it , it is possible to
tighten the type by adding a type annotation comment and enclosing the
expression in parentheses. Note that the parentheses are required.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @type {number} */</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x</span><span class="pun">)</span></pre>

<h4 id="jsdoc-template-parameter-types" style="left: -46px; position: relative;">7.10.3 Template Parameter Types<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-template-parameter-types" alt="link to jsdoc-template-parameter-types"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Always specify template parameters. This way compiler can do a better job and it
makes it easier for readers to understand what code does.</p>

<p class="bad">Bad:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Object */</span><span class="pln"> users </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Array */</span><span class="pln"> books </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[];</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Promise */</span><span class="pln"> response </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span></pre>

<p class="good">Good:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Object&lt;string, !User&gt; */</span><span class="pln"> users </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Array&lt;string&gt; */</span><span class="pln"> books </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[];</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Promise&lt;!Response&gt; */</span><span class="pln"> response </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span><span class="pln">

</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Promise&lt;undefined&gt; */</span><span class="pln"> thisPromiseReturnsNothingButParameterIsStillUseful </span><span class="pun">=</span><span class="pln"> </span><span class="pun">...;</span><span class="pln">
</span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** !Object&lt;string, *&gt; */</span><span class="pln"> mapOfEverything </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{};</span></pre>

<p>Cases when template parameters should not be used:</p>

<ul>
<li><code>Object</code> is used for type hierarchy and not as map-like structure.</li>
</ul>

<h4 id="jsdoc-function-types" style="left: -46px; position: relative;">7.10.4 Function type expressions<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-function-types" alt="link to jsdoc-function-types"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p><strong>Terminology Note</strong>: <em>function type expression</em> refers to a type annotation for
function types with the keyword <code>function</code> in the annotation (see examples
below).</p>

<p>Where the function definition is given, do not use a function type expression.
Specify parameter and return types with <code>@param</code> and <code>@return</code>, or with inline
annotations (see <a href="https://google.github.io/styleguide/jsguide.html#jsdoc-method-and-function-comments">7.8 Method and function comments</a>). This includes
anonymous functions and functions defined and assigned to a const (where the
function jsdoc appears above the whole assignment expression).</p>

<p>Function type expressions are needed, for example, inside <code>@typedef</code>, <code>@param</code>
or <code>@return</code>. Use it also for variables or properties of function type, if they
are not immediately initialized with the function definition.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">  </span><span class="com">/** @private {function(string): string} */</span><span class="pln">
  </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">idGenerator_ </span><span class="pun">=</span><span class="pln"> googFunctions</span><span class="pun">.</span><span class="pln">identity</span><span class="pun">;</span></pre>

<p>When using a function type expression, always specify the return type
explicitly. Otherwise the default return type is <q>unknown</q> (<code>?</code>), which leads to
strange and unexpected behavior, and is rarely what is actually desired.</p>

<p>Bad - type error, but no warning given:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">/** @param {function()} generateNumber */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> foo</span><span class="pun">(</span><span class="pln">generateNumber</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">const</span><span class="pln"> </span><span class="com">/** number */</span><span class="pln"> x </span><span class="pun">=</span><span class="pln"> generateNumber</span><span class="pun">();</span><span class="pln">  </span><span class="com">// No compile-time type error here.</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

foo</span><span class="pun">(()</span><span class="pln"> </span><span class="pun">=&gt;</span><span class="pln"> </span><span class="str">'clearly not a number'</span><span class="pun">);</span></pre>

<p class="good">Good:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @param {function(): *} inputFunction1 Can return any type.
 * @param {function(): undefined} inputFunction2 Definitely doesn't return
 *      anything.
 * NOTE: the return type of `foo` itself is safely implied to be {undefined}.
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> foo</span><span class="pun">(</span><span class="pln">inputFunction1</span><span class="pun">,</span><span class="pln"> inputFunction2</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{...}</span></pre>

<h4 id="jsdoc-whitespace" style="left: -46px; position: relative;">7.10.5 Whitespace<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-whitespace" alt="link to jsdoc-whitespace"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Within a type annotation, a single space or line break is required after each
comma or colon. Additional line breaks may be inserted to improve readability or
avoid exceeding the column limit. These breaks should be chosen and indented
following the applicable guidelines (e.g. <a href="https://google.github.io/styleguide/jsguide.html#formatting-line-wrapping">4.5 Line-wrapping</a> and
<a href="https://google.github.io/styleguide/jsguide.html#formatting-block-indentation">4.2 Block indentation: +2 spaces</a>). No other whitespace is allowed in type
annotations.</p>

<p class="good">Good:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @type {function(string): number} */</span><span class="pln">

</span><span class="com">/** @type {{foo: number, bar: number}} */</span><span class="pln">

</span><span class="com">/** @type {number|string} */</span><span class="pln">

</span><span class="com">/** @type {!Object&lt;string, string&gt;} */</span><span class="pln">

</span><span class="com">/** @type {function(this: Object&lt;string, string&gt;, number): string} */</span><span class="pln">

</span><span class="com">/**
 * @type {function(
 *     !SuperDuperReallyReallyLongTypedefThatForcesTheLineBreak,
 *     !OtherVeryLongTypedef): string}
 */</span><span class="pln">

</span><span class="com">/**
 * @type {!SuperDuperReallyReallyLongTypedefThatForcesTheLineBreak|
 *     !OtherVeryLongTypedef}
 */</span></pre>

<p class="bad">Bad:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="com">// Only put a space after the colon</span><span class="pln">
</span><span class="com">/** @type {function(string) : number} */</span><span class="pln">

</span><span class="com">// Put spaces after colons and commas</span><span class="pln">
</span><span class="com">/** @type {{foo:number,bar:number}} */</span><span class="pln">

</span><span class="com">// No space in union types</span><span class="pln">
</span><span class="com">/** @type {number | string} */</span></pre>

<h3 id="jsdoc-visibility-annotations" style="left: -46px; position: relative;">7.11 Visibility annotations<a href="https://google.github.io/styleguide/jsguide.html#jsdoc-visibility-annotations" alt="link to jsdoc-visibility-annotations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Visibility annotations (<code>@private</code>, <code>@package</code>, <code>@protected</code>) may be specified
in a <code>@fileoverview</code> block, or on any exported symbol or property.  Do not
specify visibility for local variables, whether within a function or at the top
level of a module.  All <code>@private</code> names must end with an underscore.</p>

<h2 id="policies" style="left: -46px; position: relative;">8 Policies<a href="https://google.github.io/styleguide/jsguide.html#policies" alt="link to policies"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<h3 id="policies-be-consistent" style="left: -46px; position: relative;">8.1 Issues unspecified by Google Style: Be Consistent!<a href="https://google.github.io/styleguide/jsguide.html#policies-be-consistent" alt="link to policies-be-consistent"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>For any style question that isn't settled definitively by this specification,
prefer to do what the other code in the same file is already doing. If that
doesn't resolve the question, consider emulating the other files in the same
package.</p>

<h3 id="policies-compiler-warnings" style="left: -46px; position: relative;">8.2 Compiler warnings<a href="https://google.github.io/styleguide/jsguide.html#policies-compiler-warnings" alt="link to policies-compiler-warnings"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="policies-use-a-standard-warning-set" style="left: -46px; position: relative;">8.2.1 Use a standard warning set<a href="https://google.github.io/styleguide/jsguide.html#policies-use-a-standard-warning-set" alt="link to policies-use-a-standard-warning-set"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>
As far as possible projects should use <code>--warning_level=VERBOSE</code>.
</p>

<h4 id="policies-how-to-handle-a-warning" style="left: -46px; position: relative;">8.2.2 How to handle a warning<a href="https://google.github.io/styleguide/jsguide.html#policies-how-to-handle-a-warning" alt="link to policies-how-to-handle-a-warning"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Before doing anything, make sure you understand exactly what the warning is
telling you. If you're not positive why a warning is appearing, ask for help
.</p>

<p>Once you understand the warning, attempt the following solutions in order:</p>

<ol>
<li><strong>First, fix it or work around it.</strong> Make a strong attempt to actually
address the warning, or find another way to accomplish the task that avoids
the situation entirely.</li>
<li><strong>Otherwise, determine if it's a false alarm.</strong> If you are convinced that
the warning is invalid and that the code is actually safe and correct, add a
comment to convince the reader of this fact and apply the <code>@suppress</code>
annotation.</li>
<li><strong>Otherwise, leave a TODO comment.</strong> This is a <strong>last resort</strong>.  If you do
this, <strong>do not suppress the warning.</strong> The warning should be visible until
it can be taken care of properly.</li>
</ol>

<h4 id="policies-suppress-a-warning-at-the-narrowest-reasonable-scope" style="left: -46px; position: relative;">8.2.3 Suppress a warning at the narrowest reasonable scope<a href="https://google.github.io/styleguide/jsguide.html#policies-suppress-a-warning-at-the-narrowest-reasonable-scope" alt="link to policies-suppress-a-warning-at-the-narrowest-reasonable-scope"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Warnings are suppressed at the narrowest reasonable scope, usually that of a single local variable or very small method. Often a variable or method is extracted for that reason alone.</p>

<p>Example</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @suppress {uselessCode} Unrecognized 'use asm' declaration */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> fn</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="str">'use asm'</span><span class="pun">;</span><span class="pln">
  </span><span class="kwd">return</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>Even a large number of suppressions in a class is still better than blinding the
entire class to this type of warning.</p>

<h3 id="policies-deprecation" style="left: -46px; position: relative;">8.3 Deprecation<a href="https://google.github.io/styleguide/jsguide.html#policies-deprecation" alt="link to policies-deprecation"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Mark deprecated methods, classes or interfaces with <code>@deprecated</code> annotations. A
deprecation comment must include simple, clear directions for people to fix
their call sites.</p>

<h3 id="policies-code-not-in-google-style" style="left: -46px; position: relative;">8.4 Code not in Google Style<a href="https://google.github.io/styleguide/jsguide.html#policies-code-not-in-google-style" alt="link to policies-code-not-in-google-style"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>You will occasionally encounter files in your codebase that are not in proper
Google Style. These may have come from an acquisition, or may have been written
before Google Style took a position on some issue, or may be in non-Google Style
for any other reason.</p>

<h4 id="policies-reformatting-existing-code" style="left: -46px; position: relative;">8.4.1 Reformatting existing code<a href="https://google.github.io/styleguide/jsguide.html#policies-reformatting-existing-code" alt="link to policies-reformatting-existing-code"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>When updating the style of existing code, follow these guidelines.</p>

<ol>
<li>It is not required to change all existing code to meet current style
guidelines.  Reformatting existing code is a trade-off between code churn
and consistency. Style rules evolve over time and these kinds of tweaks to
maintain compliance would create unnecessary churn.  However, if significant
changes are being made to a file it is expected that the file will be in
Google Style.</li>
<li>Be careful not to allow opportunistic style fixes to muddle the focus of a
CL. If you find yourself making a lot of style changes that aren’t critical
to the central focus of a CL, promote those changes to a separate CL.</li>
</ol>

<h4 id="policies-newly-added-code-use-google-style" style="left: -46px; position: relative;">8.4.2 Newly added code: use Google Style<a href="https://google.github.io/styleguide/jsguide.html#policies-newly-added-code-use-google-style" alt="link to policies-newly-added-code-use-google-style"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Brand new files use Google Style, regardless of the style choices of other files
in the same package.</p>

<p>When adding new code to a file that is not in Google Style, reformatting the
existing code first is recommended, subject to the advice in
<a href="https://google.github.io/styleguide/jsguide.html#policies-reformatting-existing-code">8.4.1 Reformatting existing code</a>.</p>

<p>If this reformatting is not done, then new code should be as consistent as
possible with existing code in the same file, but must not violate the style
guide.</p>

<h3 id="policies-local-style-rules" style="left: -46px; position: relative;">8.5 Local style rules<a href="https://google.github.io/styleguide/jsguide.html#policies-local-style-rules" alt="link to policies-local-style-rules"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Teams and projects may adopt additional style rules beyond those in this
document, but must accept that cleanup changes may not abide by these additional
rules, and must not block such cleanup changes due to violating any additional
rules. Beware of excessive rules which serve no purpose. The style guide does
not seek to define style in every possible scenario and neither should you.</p>

<h3 id="policies-generated-code-mostly-exempt" style="left: -46px; position: relative;">8.6 Generated code: mostly exempt<a href="https://google.github.io/styleguide/jsguide.html#policies-generated-code-mostly-exempt" alt="link to policies-generated-code-mostly-exempt"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Source code generated by the build process is not required to be in Google
Style. However, any generated identifiers that will be referenced from
hand-written source code must follow the naming requirements. As a special
exception, such identifiers are allowed to contain underscores, which may help
to avoid conflicts with hand-written identifiers.</p>

<h2 id="appendices" style="left: -46px; position: relative;">9 Appendices<a href="https://google.github.io/styleguide/jsguide.html#appendices" alt="link to appendices"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h2>

<h3 id="appendices-jsdoc-tag-reference" style="left: -46px; position: relative;">9.1 JSDoc tag reference<a href="https://google.github.io/styleguide/jsguide.html#appendices-jsdoc-tag-reference" alt="link to appendices-jsdoc-tag-reference"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>JSDoc serves multiple purposes in JavaScript.  In addition to being used to
generate documentation it is also used to control tooling.  The best known are
the Closure Compiler type annotations.</p>

<h4 id="appendices-type-annotations" style="left: -46px; position: relative;">9.1.1 Type annotations and other Closure Compiler annotations<a href="https://google.github.io/styleguide/jsguide.html#appendices-type-annotations" alt="link to appendices-type-annotations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Documentation for JSDoc used by the Closure Compiler is described in
<a href="https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler">Annotating JavaScript for the Closure Compiler</a> and <a href="https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System">Types in the Closure Type
System</a>.</p>

<h4 id="appendices-documentation-annotations" style="left: -46px; position: relative;">9.1.2 Documentation annotations<a href="https://google.github.io/styleguide/jsguide.html#appendices-documentation-annotations" alt="link to appendices-documentation-annotations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>In addition to the JSDoc described in <a href="https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler">Annotating JavaScript for the Closure
Compiler</a> the following tags are common and well supported by various
documentation generation tools (such as <a href="https://github.com/jleyba/js-dossier">JsDossier</a>) for purely documentation
purposes.</p>

<p>You may also see other types of JSDoc annotations in third-party code. These
annotations appear in the <a href="http://code.google.com/p/jsdoc-toolkit/wiki/TagReference">JSDoc Toolkit Tag Reference</a> but are not considered
part of valid Google style.</p>

<section class="zippy">

<h5>9.1.2.1 <code>@author</code> or <code>@owner</code> - <em>Not recommended.</em></h5>

<p><strong>Not recommended.</strong></p>

<p class="syntax">Syntax: <code>@author username@google.com (First Last)</code></p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @fileoverview Utilities for handling textareas.
 * @author kuth@google.com (Uthur Pendragon)
 */</span></pre>

<p>Documents the author of a file or the owner of a test, generally only used in
the <code>@fileoverview</code> comment. The <code>@owner</code> tag is used by the unit test dashboard
to determine who owns the test results.</p>

</section>

<section class="zippy">

<h5>9.1.2.2 <code>@bug</code></h5>

<p class="syntax">Syntax: <code>@bug bugnumber</code></p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @bug 1234567 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> testSomething</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">/**
 * @bug 1234568
 * @bug 1234569
 */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> testTwoBugs</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// …</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>Indicates what bugs the given test function regression tests.</p>

<p>Multiple bugs should each have their own <code>@bug</code> line, to make searching for
regression tests as easy as possible.</p>

</section>

<section class="zippy">

<h5>9.1.2.3 <code>@code</code> - <em>Deprecated. Do not use.</em></h5>

<p><strong>Deprecated. Do not use. Use Markdown backticks instead.</strong></p>

<p class="syntax">Syntax: <code>{@code ...}</code></p>

<p>Historically, <code>`BatchItem`</code> was written as
<code class="badcode">{@code BatchItem}</code>.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** Processes pending `BatchItem` instances. */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> processBatchItems</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span></pre>

<p>Indicates that a term in a JSDoc description is code so it may be correctly
formatted in generated documentation.</p>

</section>

<section class="zippy">

<h5>9.1.2.4 <code>@desc</code></h5>

<p class="syntax">Syntax: <code>@desc Message description</code></p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** @desc Notifying a user that their account has been created. */</span><span class="pln">
exports</span><span class="pun">.</span><span class="pln">MSG_ACCOUNT_CREATED </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">getMsg</span><span class="pun">(</span><span class="pln">
    </span><span class="str">'Your account has been successfully created.'</span><span class="pun">);</span></pre>

</section>

<section class="zippy">

<h5>9.1.2.5 <code>@link</code></h5>

<p class="syntax">Syntax: <code>{@link ...}</code></p>

<p>This tag is used to generate cross-reference links within generated
documentation.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/** Processes pending {@link BatchItem} instances. */</span><span class="pln">
</span><span class="kwd">function</span><span class="pln"> processBatchItems</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span></pre>

<p><strong>Historical note:</strong> @link tags have also been used to create external links in
generated documentation. For external links, always use Markdown's link syntax
instead:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * This class implements a useful subset of the
 * [native Event interface](https://dom.spec.whatwg.org/#event).
 */</span><span class="pln">
</span><span class="kwd">class</span><span class="pln"> </span><span class="typ">ApplicationEvent</span><span class="pln"> </span><span class="pun">{}</span></pre>

</section>

<section class="zippy">

<h5>9.1.2.6 <code>@see</code></h5>

<p class="syntax">Syntax: <code>@see Link</code></p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * Adds a single item, recklessly.
 * @see #addSafely
 * @see goog.Collect
 * @see goog.RecklessAdder#add
 */</span></pre>

<p>Reference a lookup to another class function or method.</p>

</section>

<section class="zippy">

<h5>9.1.2.7 <code>@supported</code></h5>

<p class="syntax">Syntax: <code>@supported Description</code></p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="com">/**
 * @fileoverview Event Manager
 * Provides an abstracted interface to the browsers' event systems.
 * @supported IE10+, Chrome, Safari
 */</span></pre>

<p>Used in a fileoverview to indicate what browsers are supported by the file.</p>

</section>

<h4 id="appendices-framework-specific-annotations" style="left: -46px; position: relative;">9.1.3 Framework specific annotations<a href="https://google.github.io/styleguide/jsguide.html#appendices-framework-specific-annotations" alt="link to appendices-framework-specific-annotations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The following annotations are specific to a particular framework.</p>

<section class="zippy">

<h5>9.1.3.1 <code>@ngInject</code> for Angular 1</h5>

</section>

<section class="zippy">

<h5>9.1.3.2 <code>@polymerBehavior</code> for Polymer</h5>



<p class="https"><a href="https://github.com/google/closure-compiler/wiki/Polymer-Pass">https://github.com/google/closure-compiler/wiki/Polymer-Pass</a>
</p>

</section>

<section class="zippy">

</section>

<h4 id="appendices-notes-about-standard-closure-compiler-annotations" style="left: -46px; position: relative;">9.1.4 Notes about standard Closure Compiler annotations<a href="https://google.github.io/styleguide/jsguide.html#appendices-notes-about-standard-closure-compiler-annotations" alt="link to appendices-notes-about-standard-closure-compiler-annotations"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The following tags used to be standard but are now deprecated.</p>

<section class="zippy">

<h5>9.1.4.1 <code>@expose</code> - <em>Deprecated. Do not use.</em></h5>

<p><strong>Deprecated. Do not use. Use <code>@export</code> and/or <code>@nocollapse</code> instead.</strong></p>

</section>

<section class="zippy">

<h5>9.1.4.2 <code>@inheritDoc</code> - <em>Deprecated. Do not use.</em></h5>

<p><strong>Deprecated. Do not use. Use <code>@override</code> instead.</strong></p>

</section>

<section class="zippy">

</section>

<section class="zippy">

</section>

<section class="zippy">

</section>

<section class="zippy">

</section>

<section class="zippy">

</section>

<section class="zippy">

</section>

<h3 id="appendices-commonly-misunderstood-style-rules" style="left: -46px; position: relative;">9.2 Commonly misunderstood style rules<a href="https://google.github.io/styleguide/jsguide.html#appendices-commonly-misunderstood-style-rules" alt="link to appendices-commonly-misunderstood-style-rules"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>Here is a collection of lesser-known or commonly misunderstood facts about
Google Style for JavaScript. (The following are true statements; this is not a
list of <q>myths.</q>)</p>

<ul>
<li>Neither a copyright statement nor <code>@author</code> credit is required in a source
file. (Neither is explicitly recommended, either.)</li>
<li>There is no <q>hard and fast</q> rule governing how to order the members of a
class (<a href="https://google.github.io/styleguide/jsguide.html#features-classes">5.4 Classes</a>).</li>
<li>Empty blocks can usually be represented concisely as <code>{}</code>, as detailed in
(<a href="https://google.github.io/styleguide/jsguide.html#formatting-empty-blocks">4.1.3 Empty blocks: may be concise</a>).</li>
<li>The prime directive of line-wrapping is: prefer to break at a higher
syntactic level (<a href="https://google.github.io/styleguide/jsguide.html#formatting-where-to-break">4.5.1 Where to break</a>).</li>
<li>Non-ASCII characters are allowed in string literals, comments and JSDoc,
and in fact are recommended when they make the code easier to read than the
equivalent Unicode escape would (<a href="https://google.github.io/styleguide/jsguide.html#non-ascii-characters">2.3.3 Non-ASCII characters</a>).</li>
</ul>

<h3 id="appendices-style-related-tools" style="left: -46px; position: relative;">9.3 Style-related tools<a href="https://google.github.io/styleguide/jsguide.html#appendices-style-related-tools" alt="link to appendices-style-related-tools"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<p>The following tools exist to support various aspects of Google Style.</p>

<h4 id="appendices-tools-closure-compiler" style="left: -46px; position: relative;">9.3.1 Closure Compiler<a href="https://google.github.io/styleguide/jsguide.html#appendices-tools-closure-compiler" alt="link to appendices-tools-closure-compiler"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>This program performs type checking and other checks,
optimizations and other transformations (such as ECMAScript 6 to ECMAScript 5
code lowering).</p>

<h4 id="appendices-clang-format" style="left: -46px; position: relative;">9.3.2 <code>clang-format</code><a href="https://google.github.io/styleguide/jsguide.html#appendices-clang-format" alt="link to appendices-clang-format"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>This program  reformats
JavaScript source code into Google Style, and also follows a number of
non-required but frequently readability-enhancing formatting practices.
The output produced by <code>clang-format</code> is compliant with the style guide.
</p>

<p><code>clang-format</code> is not required. Authors are allowed to change its output, and
reviewers are allowed to ask for such changes; disputes are worked out in the
usual way. However, subtrees may choose to opt in to such enforcement locally.</p>

<h4 id="appendices-closure-compiler-linter" style="left: -46px; position: relative;">9.3.3 Closure compiler linter<a href="https://google.github.io/styleguide/jsguide.html#appendices-closure-compiler-linter" alt="link to appendices-closure-compiler-linter"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>This program  checks for a
variety of missteps and anti-patterns.
</p>

<h4 id="appendices-conformance-framework" style="left: -46px; position: relative;">9.3.4 Conformance framework<a href="https://google.github.io/styleguide/jsguide.html#appendices-conformance-framework" alt="link to appendices-conformance-framework"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>The JS Conformance Framework is a tool that is part of the Closure Compiler that
provides developers a simple means to specify a set of additional checks to be
run against their code base above the standard checks.  Conformance checks can,
for example, forbid access to a certain property, or calls to a certain
function, or missing type information (unknowns).</p>

<p>These rules are commonly used to enforce critical restrictions (such as defining
globals, which could break the codebase) and security patterns (such as using
<code>eval</code> or assigning to <code>innerHTML</code>), or more loosely to improve code quality.</p>

<p>For additional information see the official documentation for the
<a href="https://github.com/google/closure-compiler/wiki/JS-Conformance-Framework">JS Conformance Framework</a>.</p>

<h3 id="appendices-legacy-exceptions" style="left: -46px; position: relative;">9.4 Exceptions for legacy platforms<a href="https://google.github.io/styleguide/jsguide.html#appendices-legacy-exceptions" alt="link to appendices-legacy-exceptions"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h3>

<h4 id="appendices-legacy-exceptions-overview" style="left: -46px; position: relative;">9.4.1 Overview<a href="https://google.github.io/styleguide/jsguide.html#appendices-legacy-exceptions-overview" alt="link to appendices-legacy-exceptions-overview"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>This section describes exceptions and additional rules to be followed when
modern ECMAScript 6 syntax is not available to the code authors. Exceptions to
the recommended style are required when ECMAScript 6 syntax is not possible and
are outlined here:</p>

<ul>
<li>Use of <code>var</code> declarations is allowed</li>
<li>Use of <code>arguments</code> is allowed</li>
<li>Optional parameters without default values are allowed</li>
</ul>

<h4 id="appendices-legacy-exceptions-var" style="left: -46px; position: relative;">9.4.2 Use <code>var</code><a href="https://google.github.io/styleguide/jsguide.html#appendices-legacy-exceptions-var" alt="link to appendices-legacy-exceptions-var"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<h5 id="appendices-legacy-exceptions-var-scope">9.4.2.1 <code>var</code> declarations are NOT block-scoped</h5>

<p><code>var</code> declarations are scoped to the beginning of the nearest enclosing
function, script or module, which can cause unexpected behavior, especially with
function closures that reference <code>var</code> declarations inside of loops. The
following code gives an example:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> </span><span class="lit">3</span><span class="pun">;</span><span class="pln"> </span><span class="pun">++</span><span class="pln">i</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">var</span><span class="pln"> iteration </span><span class="pun">=</span><span class="pln"> i</span><span class="pun">;</span><span class="pln">
  setTimeout</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">iteration</span><span class="pun">);</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> i</span><span class="pun">*</span><span class="lit">1000</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span><span class="pln">

</span><span class="com">// logs 2, 2, 2 -- NOT 0, 1, 2</span><span class="pln">
</span><span class="com">// because `iteration` is function-scoped, not local to the loop.</span><span class="pln">
</span></pre>

<h5 id="appendices-legacy-exceptions-var-declare">9.4.2.2 Declare variables as close as possible to first use</h5>

<p>Even though <code>var</code> declarations are scoped to the beginning of the enclosing
function, <code>var</code> declarations should be as close as possible to their first use,
for readability purposes. However, do not put a <code>var</code> declaration inside a block
if that variable is referenced outside the block. For example:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">function</span><span class="pln"> sillyFunction</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">var</span><span class="pln"> count </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">;</span><span class="pln">
  </span><span class="kwd">for</span><span class="pln"> </span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> x in y</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
    </span><span class="com">// "count" could be declared here, but don't do that.</span><span class="pln">
    count</span><span class="pun">++;</span><span class="pln">
  </span><span class="pun">}</span><span class="pln">
  console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">count </span><span class="pun">+</span><span class="pln"> </span><span class="str">' items in y'</span><span class="pun">);</span><span class="pln">
</span><span class="pun">}</span></pre>

<h5 id="appendices-legacy-exceptions-var-const">9.4.2.3 Use @const for constants variables</h5>

<p>For global declarations where the <code>const</code> keyword would be used, if it were
available, annotate the <code>var</code> declaration with @const instead (this is optional
for local variables).</p>

<h4 id="appendices-legacy-exceptions-function" style="left: -46px; position: relative;">9.4.3 Do not use block scoped functions declarations<a href="https://google.github.io/styleguide/jsguide.html#appendices-legacy-exceptions-function" alt="link to appendices-legacy-exceptions-function"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<p>Do <strong>not</strong> do this:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">function</span><span class="pln"> foo</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{}</span><span class="pln">
</span><span class="pun">}</span></pre>

<p>While most JavaScript VMs implemented before ECMAScript 6 support function
declarations within blocks it was not standardized. Implementations were
inconsistent with each other and with the now-standard ECMAScript 6 behavior for
block scoped function declaration. ECMAScript 5 and prior only allow for
function declarations in the root statement list of a script or function and
explicitly ban them in block scopes in strict mode.</p>

<p>To get consistent behavior, instead use a <code>var</code> initialized with a function
expression to define a function within a block:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">x</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="kwd">var</span><span class="pln"> foo </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
</span><span class="pun">}</span></pre>

<h4 id="appendices-legacy-exceptions-goog-provide" style="left: -46px; position: relative;">9.4.4 Dependency management with <code>goog.provide</code>/<code>goog.require</code><a href="https://google.github.io/styleguide/jsguide.html#appendices-legacy-exceptions-goog-provide" alt="link to appendices-legacy-exceptions-goog-provide"><img src="./Google JavaScript Style Guide_files/link.png" width="21" height="21" style="float:left;position:relative;bottom:5px;"></a></h4>

<h5 id="appendices-legacy-exceptions-goog-provide-summary">9.4.4.1 Summary</h5>

<p class="warning"><strong>WARNING: <code>goog.provide</code> dependency management is deprecated.</strong> All new files,
even in projects using <code>goog.provide</code> for older files, should use
<a href="https://google.github.io/styleguide/jsguide.html#source-file-structure"><code>goog.module</code></a>. The following rules are for
pre-existing <code>goog.provide</code> files only.</p>

<ul>
<li>Place all <code>goog.provide</code>s first, <code>goog.require</code>s second. Separate provides
from requires with an empty line.</li>
<li>Sort the entries alphabetically (uppercase first).</li>
<li>Don't wrap <code>goog.provide</code> and <code>goog.require</code> statements. Exceed 80 columns
if necessary.</li>
<li>Only provide top-level symbols.</li>
</ul>

<p><code>goog.provide</code> statements should be grouped together and placed first. All
<code>goog.require</code> statements should follow. The two lists should be separated with
an empty line.</p>

<p>Similar to import statements in other languages, <code>goog.provide</code> and
<code>goog.require</code> statements should be written in a single line, even if they
exceed the 80 column line length limit.</p>

<p>The lines should be sorted alphabetically, with uppercase letters coming first:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.helperFoo'</span><span class="pun">);</span><span class="pln">

goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'an.extremelyLongNamespace.thatSomeoneThought.wouldBeNice.andNowItIsLonger.Than80Columns'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.dom'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.dom.TagName'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.dom.classes'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.dominoes'</span><span class="pun">);</span><span class="pln">
</span></pre>

<p>All members defined on a class should be in the same file. Only top-level
classes should be provided in a file that contains multiple members defined on
the same class (e.g. enums, inner classes, etc).</p>

<p>Do this:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass'</span><span class="pun">);</span></pre>

<p>Not this:</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass.CONSTANT'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass.Enum'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass.InnerClass'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass.TypeDef'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'namespace.MyClass.staticMethod'</span><span class="pun">);</span></pre>

<p>Members on namespaces may also be provided:</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'foo.bar'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'foo.bar.CONSTANT'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'foo.bar.method'</span><span class="pun">);</span></pre>

<h5 id="appendices-legacy-exceptions-goog-scope">9.4.4.2 Aliasing with <code>goog.scope</code></h5>

<p class="warning"><strong>WARNING: <code>goog.scope</code> is deprecated.</strong> New files should not use <code>goog.scope</code>
even in projects with existing <code>goog.scope</code> usage.</p>

<p><code>goog.scope</code> may be used to shorten references to namespaced symbols in
code using <code>goog.provide</code>/<code>goog.require</code> dependency management.</p>

<p>Only one <code>goog.scope</code> invocation may be added per file. Always place it in
the global scope.</p>

<p>The opening <code>goog.scope(function() {</code> invocation must be preceded by exactly one
blank line and follow any <code>goog.provide</code> statements, <code>goog.require</code> statements,
or top-level comments. The invocation must be closed on the last line in the
file. Append <code>// goog.scope</code> to the closing statement of the scope. Separate the
comment from the semicolon by two spaces.</p>

<p>Similar to C++ namespaces, do not indent under <code>goog.scope</code> declarations.
Instead, continue from the 0 column.</p>

<p>Only make aliases for names that will not be re-assigned to another object
(e.g., most constructors, enums, and namespaces). Do not do this (see below for
how to alias a constructor):</p>

<pre class="language-js prettyprint badcode prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">scope</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> </span><span class="typ">Button</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">ui</span><span class="pun">.</span><span class="typ">Button</span><span class="pun">;</span><span class="pln">

</span><span class="typ">Button</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">};</span><span class="pln">
</span><span class="pun">...</span></pre>

<p>Names must be the same as the last property of the global that they are aliasing.</p>

<pre class="language-js prettyprint prettyprinted" style=""><span class="pln">goog</span><span class="pun">.</span><span class="pln">provide</span><span class="pun">(</span><span class="str">'my.module.SomeType'</span><span class="pun">);</span><span class="pln">

goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.dom'</span><span class="pun">);</span><span class="pln">
goog</span><span class="pun">.</span><span class="pln">require</span><span class="pun">(</span><span class="str">'goog.ui.Button'</span><span class="pun">);</span><span class="pln">

goog</span><span class="pun">.</span><span class="pln">scope</span><span class="pun">(</span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> </span><span class="typ">Button</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">ui</span><span class="pun">.</span><span class="typ">Button</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> dom </span><span class="pun">=</span><span class="pln"> goog</span><span class="pun">.</span><span class="pln">dom</span><span class="pun">;</span><span class="pln">

</span><span class="com">// Alias new types after the constructor declaration.</span><span class="pln">
my</span><span class="pun">.</span><span class="pln">module</span><span class="pun">.</span><span class="typ">SomeType</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="pun">...</span><span class="pln"> </span><span class="pun">};</span><span class="pln">
</span><span class="kwd">var</span><span class="pln"> </span><span class="typ">SomeType</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> my</span><span class="pun">.</span><span class="pln">module</span><span class="pun">.</span><span class="typ">SomeType</span><span class="pun">;</span><span class="pln">

</span><span class="com">// Declare methods on the prototype as usual:</span><span class="pln">
</span><span class="typ">SomeType</span><span class="pun">.</span><span class="pln">prototype</span><span class="pun">.</span><span class="pln">findButton </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
  </span><span class="com">// Button as aliased above.</span><span class="pln">
  </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">button </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Button</span><span class="pun">(</span><span class="pln">dom</span><span class="pun">.</span><span class="pln">getElement</span><span class="pun">(</span><span class="str">'my-button'</span><span class="pun">));</span><span class="pln">
</span><span class="pun">};</span><span class="pln">
</span><span class="pun">...</span><span class="pln">
</span><span class="pun">});</span><span class="pln">  </span><span class="com">// goog.scope</span></pre>

<h5 id="appendices-legacy-exceptions-forward-declare">9.4.4.3 <code>goog.forwardDeclare</code></h5>

<p>Prefer to use <code>goog.requireType</code> instead of <code>goog.forwardDeclare</code> to break
circular dependencies between files in the same library. Unlike <code>goog.require</code>,
a <code>goog.requireType</code> statement is allowed to import a namespace before it is
defined.</p>

<p><code>goog.forwardDeclare</code> may still be used in legacy code to break circular
references spanning across library boundaries, but newer code should be
structured to avoid it.</p>

<p><code>goog.forwardDeclare</code> statements must follow the same style rules as
<code>goog.require</code> and <code>goog.requireType</code>. The entire block of
<code>goog.forwardDeclare</code>, <code>goog.require</code> and <code>goog.requireType</code> statements is
sorted alphabetically.</p>

</div>


</body></html>